Skip to content

Allow per-instance filesystem protocols - #2117

Open
be-student wants to merge 1 commit into
fsspec:masterfrom
be-student:codex/1800-instance-protocol
Open

Allow per-instance filesystem protocols#2117
be-student wants to merge 1 commit into
fsspec:masterfrom
be-student:codex/1800-instance-protocol

Conversation

@be-student

Copy link
Copy Markdown

Closes #1800

AbstractFileSystem.protocol is currently declared as a ClassVar, so type checkers reject filesystem adapters that choose their protocol from constructor state. This removes the ClassVar restriction while preserving the existing string-or-tuple type and class default.

Concrete implementations with a fixed protocol can continue declaring their own ClassVar. The changelog now documents support for per-instance protocol selection.

Validation:

  • The issue-shaped Pyright fixture fails before the change with Attribute "protocol" cannot be assigned through a class instance because it is a ClassVar and passes afterward with 0 errors.
  • fsspec/tests/test_spec.py portable tests: 186 passed, 10 skipped, 1 xfailed. The 52 excluded Bash-reference cases require GNU stat -c and fail unchanged on macOS.
  • Ruff check, Ruff format check, and git diff --check pass.

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.

Don't type protocol as ClassVar

1 participant