filesystem_spec icon indicating copy to clipboard operation
filesystem_spec copied to clipboard

create multiple separate memory filesystems

Open milahu opened this issue 5 months ago • 2 comments

fsspec/implementations/memory.py

class MemoryFileSystem(AbstractFileSystem):
    """A filesystem based on a dict of BytesIO objects

    This is a global filesystem so instances of this class all point to the same
    in memory filesystem.
    """

    store: ClassVar[dict[str, Any]] = {}  # global, do not overwrite!
    pseudo_dirs = [""]  # global, do not overwrite!

... ok, but i need multiple different memory filesystems in parallel

assert (
    fsspec.filesystem("memory://").store !=
    fsspec.filesystem("memory://").store
)

this should be as simple as moving store and pseudo_dirs to def __init__

maybe add a new protocol localmemory

milahu avatar Aug 07 '25 13:08 milahu