-
Notifications
You must be signed in to change notification settings - Fork 305
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
mypy will never honor dependencies #733
Comments
…est dependencies when they declare type support. Fixes #733.
In #734, I tried to address the issue, but found I couldn't effectively suppress the failing type checks, so I'm giving up. |
@jaraco Thanks for pointing out an opportunity to improve the type-checking process; I don't pretend that I got it right, and I'm always interested in learning more about the tooling. Can you elaborate on "(a) not installing them"? Is that the because of the Lines 71 to 72 in c1807fa
If we remove that, will that resolve the issue with dependencies not being type-checked, and avoid the need to duplicate them in Re: not enabling
|
Good point separating the two concerns. Yes, removing skip_install will bring in the dependencies. I think you're right about the second point. |
Yesterday, in keyring, I added this change, which if I understand correctly should solve the failing type checks:
But it didn't. I'm surprised that mypy couldn't resolve the types for get_credential and get_password, because In this change, I even added types to the parameters for I wonder if the problem is that the accessor functions don't have type declarations. I would have expected mypy to infer the parameter and return types for those accessor functions from the types declared on the delegated behavior internally. I'm disinterested in copy/pasting types through every accessor function, and I'm not even sure that would help. |
In jaraco/keyring@ceeaa92, I added the redundant type definitions I was reluctant to add. With these, twine now complains thus:
|
It seems that twine's aggressive typing settings, and in this case |
I filed an issue upstream with mypy to see if there's some way the inference could be improved. In the meantime, I'll cut a new release of keyring to satisfy twine's usage. I've also found that twine's usage needs some tweaks to support this new mode, so I've applied those in 4cd95a6. |
* Install the project and dependencies in 'types'. Ref #733. * Cast parameters to match keyring's expectations. * Bump requirement on keyring in typechecks * Remove ignores for importlib_metadata and keyring, both typed.
Thanks, @jaraco. I didn't dive into all the links you provided, but IIRC the various ways that username/password can be sourced led to some typing complexity.
FWIW, the Twine typing configuration is the equivalent of |
No. At this point, I'm not suggesting any change. I'm leaning toward reducing strictness, because the amount of time I'm spending fussing with types continues to increase while the value I get from them remains small. At this point, I'll persevere through. If it remains untenable, I'll write up another proposal. Thanks for asking. |
Yet the value it provides to others seems to be immense. It sounds like you're suggesting if this continues to just inconvenience you, you'll undo the hard work of others. I don't think that's actually what you're trying to suggest, but that's what it comes across as |
The current mypy config currently ignores dependencies by (a) not installing them and then (b) ignoring missing imports for those dependencies.
The non-installation of dependencies means that even for projects that have since added and declared typing support (both keyring and importlib_metadata fall into this boat), they're not tested.
I did find that if I repeated the dependencies in the type checks that the types appear to be checked, but that requires repeating the dependencies from setup.cfg (and thus keeping them in sync). e.g.:
Is that the intention, to keep a separate subset of dependencies in the 'types' check?
In my other projects, I enable
ignore_missing_imports
globally and let dependencies declare and implement typing support at their pace. Any reason not to do that?The text was updated successfully, but these errors were encountered: