fonttools: pyfilesystem2 (fs) is no longer maintained; find a replacement or avoid dependency?
the fs module that fontTools.ufoLib uses to implement .ufoz (UFO inside a .zip file) hasn’t received an update in more than 2 years, it’s basically unmaintained, see: https://github.com/PyFilesystem/pyfilesystem2/issues/571
There is a new module called https://github.com/fsspec/filesystem_spec which may be a suitable replacement and is more actively maintained. Maybe we should try to use that. It does have a ZipFileSystem implementation: https://github.com/fsspec/filesystem_spec/blob/master/fsspec/implementations/zip.py
Or alternatively we could reimplement our own filesystem-like wrapper around a zip file.
I’d prefer option 1), or whichever is easier.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (11 by maintainers)
I started looking at this last week. fsspec supports all the features of pyfilesystem2 and is well maintained. The API is slightly different (some methods do the same thing but are named differently, or e.g. the local filesystem always uses absolute paths whereas pyfs2 would let one create a filesystem instance from a specific directory and use relative paths), but we can easily adapt our code to it, perhaps define a wrapper that exposes the same interface (or the subset that we currently use) as pyfilesystem2 which internally uses fsspec object so we don’t need to update all the call sites. I can work on that, unless @behdad beats me to it
It can but only works if you are creating a new zip, not if updating in place (maybe it can append files but we sometimes also need to remove files so that won’t work). I think it’s just best to write to a temporary location whether or not we are updating in-place or writing a new UFOZ, and only zip at the end and move when everything is successful, easier and safer.
In Debian we are in freeze period, but yeah this will be hugely appreciated.
Status of
python-fscame in light because of thesixremoval crusade … https://wiki.debian.org/Python3-six-removalI don’t know/think Fedora is tackling this yet. Another worrysome key library is
dateutil. Otherwise it’s going smoothly slow & steady now.I’ll add my name to the list of people who are excited you are working on this. I am working through making
python-fsbuild and pass (enough) tests with Python 3.14 in Fedora Rawhide, and it’s hard to work on an upstream that still hasn’t merged PR’s for changes in Python 3.12.Looks like I was wrong: https://github.com/behdad/ufoLib/commit/acfe65b312c3c7fe5e31b2040b406f145e396ebb
I just had a brief look at fsspec: it looks very good. Also in favor of option 1).