Skip to content

WholeFileCacheFileSystem: _cat_file exists on instance but not on class #2009

@hadim

Description

@hadim

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions