-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Enable (partial) type hinting for downstream consumers #13380
Comments
As I started working on my conda-auth plugin, I also ran into to I have since added If there's something else that needs to be done to make these classes more "typing friendly", we'd be happy to help make that happen. Feel free to submit your own pull requests too. |
I completely missed that file when I briefly searched for it yesterday. This is what I get for not using search. I appear to be on
I guess what its actually mad about is that the parameters to the constructor are untyped and I just made an assumption typing wasn't being presented in the package. Still not sure what the issue with the exception is, but I can make a quick PR to add type hints to |
Ah, it seems none of the exceptions are typed, so the Any is coming from the exception constructor (and maybe inheritance?) as well. |
- Adds type hinting discussed in Issue conda#13380 - Also adds type hints for `InvalidVersionSpec` and related exceptions
* Adds type hinting for `VersionOrder` class - Adds type hinting discussed in Issue #13380 - Also adds type hints for `InvalidVersionSpec` and related exceptions * Triggering CLA check
Closing as the type hinting PR got merged and should be sufficient for my needs. |
Checklist
What is the idea?
We should enable or partially enable type hinting support for the sake of projects that use
conda
.Why is this needed?
My team heavily relies on the
VersionOrder
class to perform comparisons between software version numbers. We have started usingmypy
to statically verify our python code against most (and eventually all) of our projects.When I import the
VersionOrder
class and theInvalidVersionSpec
exception,mypy
treats them asAny
types and can't resolve that they are classes.I know some parts of the project use type hinting but it isn't universal. For my particular use case, I just need a few classes exposed to
mypy
.What should happen?
From memory this should be as simple as adding a
py.typed
file to theconda/
directory or we could slowly roll it out and enable it in a few folders at a time.Additional Context
I believe the PR is simple, but it might be a little controversial. Getting full and accurate type hints for the entire
conda
project is a obviously a big ask and not what I need right now. BUT, saying we support full type hints when we don't could also be confusing and problematic for others.For now, I can suppress
mypy
in my project as a work around. But it would be nice not to have to disable static analyzer checks everytime I try to use this class.The text was updated successfully, but these errors were encountered: