-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add type annotations to base spec #1676
base: master
Are you sure you want to change the base?
Conversation
9857dbd
to
199b92e
Compare
Thanks for giving this a start. Perhaps you already appreciate that this process will not be easy for the package, and spec might have been the hardest place to start (since all these methods are overridden in various duck ways in the backend implementations). |
Preface: Just a random user. This is a really good start (I love me some types), though I feel like it could do with some minor improvements
...however, I feel like it could just devolve into a bunch of minor nitpicks, whereas this already provides lots of value as-is. What's the strategy towards a merge here? Grab a bunch of popular downstream consumers and ensure these don't cause conflicts with any overloaded duck typing happening there? |
@mon : as with my initial comments, I am happy to see typing leak slowly into fsspec, but the duck-type design of the (old!) code means that it will be hard to have it everywhere and certainly very hard to get mypy happy throughout the codebase, including downstream implementations. It gets complicated fast, because of issues like people demanding support for Path instances where originally only strings were allowed. The end-user API is based on convenience, but library developers using fsspec want strict definitions - requirements that are hard to simultaneously meet.
It shouldn't be possible to break code with types alone, right? |
At runtime, there will be no effect, unless you type annotate forward/circular references. But these are found as soon as the module is imported, so shouldn't ever be a problem for you, only the person adding the types (and easily fixed by gating the import behind an My worry was there might just be some downstream projects that, for example, extend the valid argument types for some functions, and making them specifically typed (instead of the default |
See #625 (comment)