-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Allow/disallow pep561 packages #8545
Comments
I can see how this could be useful., and this shouldn't be hard to implement Random thoughts:
|
I think I like either |
I am a "-0" on this; I don't like adding more complexity to our import system. But also I'd be happy to merge it. Let's make a decision on it so we can resolve #8512. |
Yeah I'm kinda -0 on this too. The complexity would be unfortunate, but I can kinda see the use case. |
Just to clarify all selected flags will be usable via mypy.ini, correct? |
👍 for this. I am using some packages that are fully typed and are PEP-561 compatible in principle (they have a I can of course work around it by creating the |
Adding my proposal from #10783, which concerns packages that have typing information but forgot to include a This should be a configuration option mirroring [mypy-missing.*]
ignore_missing_imports = True Instead, since I know this package has typing information but forgot the [mypy-missing.*]
allow_missing_pytyped = True |
I can see the appeal of providing a way to work around library shortcomings like this, but it would serve the entire Python community better if you would work with the library maintainer to fix the problem at the source. If the library is no longer maintained, perhaps a fork is the best answer? |
The library is maintained, just slowly because the maintainer is also a maintainer of many other packages. I've already reached out to projects and even provided PRs sometimes, but I have no control over when they have time to review, merge, and release new versions. For the same reason, I have no desire to fork, as I already maintain enough projects as it is. |
I believe the disallow use case can already be accomplished using something like:
|
What is the difference between |
@hauntsaninja ping, could you respond to my questions about your proposed workaround? |
ignore_missing_imports will only ignore missing imports. It will still resolve imports that exist, see example I believe you'd only need |
|
You're right, sorry for confusion. The thing that triggered me to post ^^ was someone on gitter asking for the equivalent of |
Are there any updates on this? |
Just found this while searching for a way to force mypy to treat a third-party library as py.typed. Any plans on this? |
This would be extremely useful feature to include. |
Similarly to @and3rson , I also came here because a third party library is missing a py.typed which I have no way of fixing in the short term |
I've opened a PR to implement this at #17712, would be great if someone could review this |
+1 for this. |
@Alexander255 has requested a flag
--pep561-override
to allow listing packages as pep 561 compatible when they are not. This got me thinking and I think the best UX for this would be a pair of flags:--allow-installed-package NAME
and--disallow-installed-package NAME
(or something like that).The idea is to solve two problems:
Some people publish PEP 561 packages that are either too unstable or flat out broken for some users. This allows the user to disable the package until things are fixed.
At the other end of the spectrum, some packagers are conservative on adding types, and while they exist, they are not public (yet). Some users would still like to use them.
This would eliminate
--no-site-packages
, which is a rather blunt instrument.The text was updated successfully, but these errors were encountered: