pyfilesystem2 icon indicating copy to clipboard operation
pyfilesystem2 copied to clipboard

Status of this project

Open ntarocco opened this issue 2 years ago • 10 comments

Are you still maintaining this project? Is it something that we can rely on when building products?

ntarocco avatar Apr 04 '23 14:04 ntarocco

Looks bad :( - the last commit was almost a year ago and the tests don't run against 3.12 even though there's a PR which apparently fixes it.

rkhwaja avatar Sep 26 '23 06:09 rkhwaja

Friendly ping @tfeldmann @willmcgugan @althonos @odgalvin

gaby avatar Nov 09 '23 22:11 gaby

Yeah to be honest I'm migrating my projects away from pyfilesystem. Nowadays I mount remote filesystems locally and handle them with the standard library. For tests I migrated to pyfakefs instead of using MemoryFS.

tfeldmann avatar Nov 10 '23 11:11 tfeldmann

@tfeldmann I'm mainly interested in MemoryFs for creating temporary files, packaging files and reducing disk i/o for applications. I wonder if pyfakefs can be used as a regular lib outside of pytest.

gaby avatar Nov 10 '23 13:11 gaby

I'm using it only with pytest at the moment. But something like this could work:

from pathlib import Path

from pyfakefs.fake_filesystem_unittest import patchfs


@patchfs()
def sometempstuff(fs):
    path = Path("./testfile.txt")
    print(type(path))
    path.write_text("Hello World")
    return (path.read_text(), path.stat().st_size)


text, size = sometempstuff()
print(f"{text}: {size}")
print(f"Exists in real FS: {Path('./testfile.txt').exists()}")

As I understand you need to be careful where you create the Path objects as you will either get a pathlib.Path or a FakePathlibModule.Path. This applies not only to pathlib but pretty much the entire python stdlib.

tfeldmann avatar Nov 10 '23 13:11 tfeldmann

@tfeldmann Thank you for the example, I will give it a try.

I also considered forking just the MemoryFS into a separate library, overall this package still works is just that there hasn't been any activity in 1 year, and several PR's ready to be merged

gaby avatar Nov 10 '23 15:11 gaby

@althonos

johnslavik avatar Jan 23 '24 18:01 johnslavik

You could have a look at fsspec: https://filesystem-spec.readthedocs.io/en/latest/api.html#implementations

frafra avatar Apr 12 '24 11:04 frafra

@frafra Thanks for sharing

gaby avatar Apr 12 '24 13:04 gaby