Open leos opened 4 years ago
This is a known problem. This happens because we run django.setup()
inside the plugin.
And if your code is broken - the plugin will crash. https://github.com/typeddjango/django-stubs#mypy-crashes-when-i-run-it-with-this-plugin-installed
I guess the only thing we can do is to make better error messages. I will work on it!
Thanks for looking at this. I haven't looked deeper at the code but could you just catch the exception, create a mypy warning/error and then simply continue on? The plugin would be effectively disabled until the error was fixed but it wouldn't crash mypy.
Yes, this is exactly my plan. By the way, @leos do you want to take this one? I can reassign the issue if you want.
I appreciate the offer but I unfortunately don't have the time to dig in right now
Bug report
What's wrong
This plugin crashes
mypy
when there is an unknown import in a source file. Repro is super simple, addfrom foo import bar
to source file, run mypy against it with this plugin.Actual behavior: uncaught
ModuleNotFoundError
How is that should be
Expected behavior:
mypy
works properly and plugin doesn't crash it.System information
python
version: 3.7.6django
version: 3.0.3mypy
version: 0.761django-stubs
version: 1.4.0