Latest version seems to break mypy
See original GitHub issuewhen running mypy on my project, I get this error:
Error importing plugin sqlmypy
When debugging a little bit, the problem seems to be here:
def get_dynamic_class_hook(self, fullname: str) -> CB[DynamicClassDefContext]:
File "/usr/lib/python3.5/typing.py", line 546, in __getitem__
"Cannot subscript an existing Union. Use Union[u, t] instead.")
TypeError: Cannot subscript an existing Union. Use Union[u, t] instead.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Tests aren't enough: Case study after adding type hints to urllib3
We wanted to add Mypy to our continuous integration to ensure new contributors wouldn't accidentally break type hints but we also wanted to ......
Read more >Ubuntu Manpage: mypy - Optional static typing for Python
If an expression of type Any appears anywhere in the module mypy will output an error unless the expression is immediately used as...
Read more >More types - mypy 0.991 documentation
More types#. This section introduces a few additional kinds of types, including NoReturn , NewType , TypedDict , and types for async code....
Read more >Modernize Your Sinful Python Code with Beautiful Type Hints
It seems like mypy is okay with everything written so far. I now want to intentionally break the type hint to see what...
Read more >mypy and basic inheritance [duplicate] - python - Stack Overflow
Obviously, this will break once any subclass of Parent introduces a field ... Ignoring the inheritance for a moment, this seems entirely ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I fixed this issue by adding
sqlalchemy-stubs
explicitly in.pre-commit-config.yaml
, like this:I do… however, I discovered that, for whatever reason, my shell was using my global mypy. Forcing a re-hash fixed things. Sorry for the confusion!