Proper way to use nbqa-mypy
See original GitHub issueThanks for your work! I have a question, that might convert into an issue, so I’m trying to use nbqa-mypy
, my config looks like this:
- repo: https://github.com/nbQA-dev/nbQA
rev: 0.5.7
hooks:
- id: nbqa-mypy
args: ["--nbqa-ignore-cells=%%R", "--strict", "--show-error-codes"]
But I’m getting error about missing modules that are part of the repository, example:
pipelines/notebooks/foo.ipynb:cell_2:1: error: Cannot find implementation or library stub for module named 'my_utils' [import
Where the repo contains {pipelines, my_utils}
in the root, and import from my_utils
doesn’t raise issues in py modules and vanilla mypy checks. Am I doing sth wrong? Is there a blessed way to use nbqa-mypy
and give access to the main repo? Maybe nbqa-mypy
is missing some step to add repo to the pre-commit’s nbqa-mypy virtualenv?
Issue Analytics
- State:
- Created 3 years ago
- Comments:28 (7 by maintainers)
Top Results From Across the Web
nbQA-dev/nbQA: Run isort, pyupgrade, mypy, pylint, flake8 ...
Pre-commit. Here's an example of how to set up some pre-commit hooks: put this in your .pre-commit-config.yaml ...
Read more >nbQA Documentation
Here's one way to set one up using Conda - see this tutorial for other options. ... nbqa mypy my_notebook.ipynb --ignore-missing-imports.
Read more >Keep your Jupyter Notebooks maintainable with nbQA
If we want to use any of the following excellent tools: flake8 (style guide enforcement); pylint (suggests refactorings, brings up code smells) ...
Read more >Type-check Jupyter Notebooks with mypy - Stack Overflow
You can: Convert all notebooks to python, then run mypy on that (How do I convert a IPython Notebook into a Python file...
Read more >nbqa · PyPI
You can configure nbQA either at the command line, or by using a .nbqa.ini file. We'll see some examples below. Extra flags. If ......
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
Seems like we need to set
MYPYPATH
in addition toPYTHONPATH
https://mypy.readthedocs.io/en/latest/running_mypy.html#following-importsWill make a new release over the weekend
I would suggest using
subprocess.run
and capturing the output. If you share your command I can try to be more specific