WholeFileCacheFileSystem delegates _cat_file to the wrapped filesystem at the instance level, but the method is not defined on the class. This means hasattr(type(fs), '_cat_file') returns False while hasattr(fs, '_cat_file') returns True.
In practice this causes an AttributeError in libraries that check filesystem capabilities on the class (e.g. universal_pathlib, zarr). I hit this when reading a Zarr store through UPath("filecache::s3://...").
Minimal reproducer (fsspec only)
import fsspec
fs = fsspec.filesystem("filecache", target_protocol="s3", cache_storage="/tmp/test")
print(type(fs).__name__) # WholeFileCacheFileSystem
print(hasattr(fs, "_cat_file")) # True
print(hasattr(type(fs), "_cat_file")) # False
type(fs)._cat_file # AttributeError
Versions
| Package |
Version |
| python |
3.13.13 |
| fsspec |
2026.2.0 |
| s3fs |
2026.2.0 |
| universal_pathlib |
0.3.10 |
| zarr |
3.1.5 |
Question
Is this instance-only delegation intentional by design? Or should _cat_file (and similar methods) be defined on the class as well? If this is by design, I'll report the issue downstream to zarr and/or universal_pathlib instead.
WholeFileCacheFileSystemdelegates_cat_fileto the wrapped filesystem at the instance level, but the method is not defined on the class. This meanshasattr(type(fs), '_cat_file')returnsFalsewhilehasattr(fs, '_cat_file')returnsTrue.In practice this causes an
AttributeErrorin libraries that check filesystem capabilities on the class (e.g.universal_pathlib,zarr). I hit this when reading a Zarr store throughUPath("filecache::s3://...").Minimal reproducer (fsspec only)
Versions
Question
Is this instance-only delegation intentional by design? Or should
_cat_file(and similar methods) be defined on the class as well? If this is by design, I'll report the issue downstream tozarrand/oruniversal_pathlibinstead.