-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Option for not following certain modules #7537
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
Comments
Using
|
There doesn't seem to be any good way to ignore a file what generates syntax errors. One option would be to allow specifying that some modules should be skipped in the configuration file, similar to |
I have a similar issue related to pytorch. Consider the following program:
this works; however, mypy doesn't like it:
which is (I think) an artifact of some metaclass voodoo that pytorch is doing. I could stick a
but that didn't fix it. Also per the documentation, I tried in my mypy.ini doing
but that didn't work (and, given the existence of this issue, I guess is not supposed to work?) -- even |
btw this is with mypy==0.720 |
I wonder if this would work?
|
Alternatively (perhaps less hacky):
|
both of those seem to fix the mypy issue, but they also seem to break the VSCode autosuggest / autocomplete behavior, which is not a great trade-off. |
Bummer. Maybe you can rig something with
??? |
yes, that seems to work, we'll see how my team feels about it, thanks! |
Then I propose to close this -- there's not likely going to be a new feature to make this easier. |
When working with a large codebase with hundreds of imports of a certain module, like tensorflow, where many of them are inside the code to make imports of modules faster, this would litter the code with additional hundreds of lines of code just to fix this... I think this is not really a good solution, and it should be possible to do ignore it globally for mypy without changing the sources. Especially since the "crashing" code is appareantly valid python code, and just not handled well by |
Hm, I think it's up to torch to fix this problem somehow. Their distro includes a
But given that that |
Currently, with
Running mypy gives:
This file contains:
From #5696 I understand that this is an issue in the tensorflow files. However, I don't know how I can work around this without modifying all tensorflow python files and deleting these comments.
import tensorflow # type: ignore
as suggested in #545 doesn't seem to help. And I wouldn't want to set
--follow-imports=skip
just because of tensorflow, as I have many other imports which are typed correctly and which I'd like to have followed...The text was updated successfully, but these errors were encountered: