Skip to content

Type annotations for base spec#2041

Open
slmnsh wants to merge 4 commits into
fsspec:masterfrom
slmnsh:master
Open

Type annotations for base spec#2041
slmnsh wants to merge 4 commits into
fsspec:masterfrom
slmnsh:master

Conversation

@slmnsh

@slmnsh slmnsh commented May 26, 2026

Copy link
Copy Markdown

Fixes #625

Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py

@martindurant martindurant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts.

My biggest gripe is the extended overrides, mostly because of detail=True|False.

Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
Comment thread fsspec/spec.py Outdated
@slmnsh

slmnsh commented May 29, 2026

Copy link
Copy Markdown
Author

@martindurant Thanks for review! I think I should've started with type stubs then later maybe add inline types. type stubs will be cleaner to add than inline types.

I will push type stubs this weekend.

@slmnsh

slmnsh commented Jun 1, 2026

Copy link
Copy Markdown
Author

@martindurant I have added completely separate type stub file. I am planning to add more for known implementations once you review this

@martindurant

Copy link
Copy Markdown
Member

Much happier with the annotations separate :). Now the main code is not affected, nor even import times. Do you have any thoughts on how best to keep the code and types in sync in the future?

@slmnsh

slmnsh commented Jun 1, 2026

Copy link
Copy Markdown
Author

mypy has stubtest for testing stub maybe we can incorporate that

https://mypy.readthedocs.io/en/stable/stubtest.html#automatic-stub-testing-stubtest

@martindurant

Copy link
Copy Markdown
Member

Can you please draft a non-required CI run with that, and text instructions for how to go about updating types in the future as the API changes?

@slmnsh

slmnsh commented Jul 19, 2026

Copy link
Copy Markdown
Author

@martindurant Sorry for delays. I added "Run Stub Tests" step for running stub test it will raise error if failed and instructions to readme.

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.

Type annotations?

2 participants