-
Notifications
You must be signed in to change notification settings - Fork 25
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
Ignore types for stuff imported from pip #171
Conversation
Pre-Commit Test failed! Click here
|
There are differences in the versions of pip which mypy cannot handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what do you think about it.
First, thanks for this work 👍🏻
Generally, I do not like ignoring typing if it is used, but it sounds to me we have no easy option here. Maintaining proper typing inside micropipenv code sounds like a challenging task based on your observations. I'm fine with merging this and keeping enforced typing for functions we export outside of micropipenv (end elsewhere where possible). Given the fact the testsuite is pretty extensive and covers logic required for different pip versions exposing different API, I think we can have this in.
Thanks again for this work.
P.S.: I've completely installed a windows machine just to realize the only thing I need is to upgrade pip in a virtual environment.
PS: I hope you switch back to fedora :)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fridex The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I'm gonna follow the mentioned mypy issues and once fixed, we can stop ignoring some of the types. |
There are differences in the versions of pip which mypy cannot handle.
The problem we have here is caused by these facts:
Unfortunately, it seems that there is no easy solution for that now. There are many issues in mypy complaining about handling the conditional imports or as we have here the try/except approach for imports, see the main issue: python/mypy#1297 and many more.
A much harder approach to work around this problem might be to use if/else instead of try/except for imports but it's not always possible to import the right thing from the right place based just on the version.
Let me know what do you think about it.
P.S.: I've completely installed a windows machine just to realize the only thing I need is to upgrade pip in a virtual environment.