Skip to content

Forward local_file through DirFileSystem - #2212

Merged
martindurant merged 2 commits into
fsspec:masterfrom
charan-rathore:fix-1110-dirfs-local-file
Oct 1, 2026
Merged

martindurant merged 2 commits into
fsspec:masterfrom
charan-rathore:fix-1110-dirfs-local-file

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

Fixes #1110.

DirFileSystem wraps a filesystem but does not expose its local_file flag. A directory wrapper around LocalFileSystem therefore fails the local-file check in open_local even though its files are local.

Add a property alongside the existing sep property that reads the wrapped filesystem's local_file flag, defaulting to False when the wrapped filesystem has no flag. This follows the passthrough approach efiop suggested in the issue and martindurant invited a contribution for.

Tests cover local and memory filesystems, nested directory wrappers, an explicit False flag, and open_local's accept/reject checks. The local test opens a real file through OpenFile/OpenFiles. Only URL-to-filesystem construction is substituted so open_local receives the already constructed wrapper.

Verification

  • Baseline: 5 new cases fail with missing local_file.
  • Patched: directory/cache/core/spec suites 622 passed, 48 skipped, 1 xfailed on Linux/Python 3.10.12.
  • Independent fresh-clone runner: baseline 5 failures, directory/core/spec suite 517 passed, 17 skipped, 1 xfailed.
  • Ruff 0.14.3 check/format and git diff --check clean.
  • Dev/Fixes changelog entry included.

@martindurant
martindurant merged commit 21e18b0 into fsspec:master Oct 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DirFileSystem not forwarding 'local_file'

2 participants