notebook shadow module causing mypy errors
See original GitHub issueWhen a package contains both notebook and a module with the same exact name, it seems like nbqa-mypy gets confused and the notebook shadows the module causing mypy errors.
Example structure:
pipelines/foo
├── __init__.py
├── bar.py
├── bar.ipynb
My config:
- repo: https://github.com/nbQA-dev/nbQA
rev: 0.5.9
hooks:
- id: nbqa-mypy
args: ["--nbqa-ignore-cells=%%R,%%bash", "--strict", "--show-error-codes", "--pretty", "--show-error-context"]
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Fail fast if special module like typing not from typeshed #1876
mypy generally crashes with an internal error if it winds up trying to handle a file named typing.py , apparently due to confusion...
Read more >Common issues and solutions - mypy 0.991 documentation
There are several common reasons why obviously wrong code is not flagged as an error. The function containing the error is not annotated....
Read more >Installing mypy leads to "shadows library module"-error
Now if I execute mypy I get an error that '"typing_extensions.py" shadows library module "typing_extensions"': mypy --namespace-packages ...
Read more >AttributeError: module 'X' has no attribute 'Y' in Python
Here is an example of how the error is caused when an imported module is shadowed by a local file with the same...
Read more >mypy(1) — mypy — Debian testing
Mypy is a static type checker for Python 3 and Python 2.7. If you sprinkle your code with type annotations, mypy can type...
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 FreeTop 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
Top GitHub Comments
👋 @MarcoGorelli, yep, looks like 0.7.0 fixed it, thank you!
@ravwojdyla if you update to 0.6.0, I’d like to think this is fixed - please do let us know if you encounter any other issues (or if this one is still present), and thank you so much for your help!