nbQA-dev / nbQA

Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks
https://nbqa.readthedocs.io/en/latest/index.html
MIT License
1.01k stars 39 forks source link

add support for pyright #647

Open MarcoGorelli opened 3 years ago

MarcoGorelli commented 3 years ago

What needs doing:

karolzlot commented 1 year ago

@MarcoGorelli is it supported?

MarcoGorelli commented 1 year ago

Hi - I'd expect it to work out-of-the-box

If not, please do let me know

karolzlot commented 1 year ago

@MarcoGorelli

So I tested it and it works, but not in a way which I need it to work. I was unable so far to find any workaround.

The issue is that nbqa assumes that all files may be evaluated independently, which is not true for type checkers, especially not for pyright. In this case I want pyright to evaluate notebooks in context of all other files in repository. When I specify . path to nbqa, then it feeds pyright only with python files generated from notebooks. I expected that it will also include my other python files, but this is not the case.

What I'm missing in this tool is the ability to convert notebook to python files and keep them. I see that currently this feature can't be used independently and also those generated python files are instantly removed.
If I could generate those python files and keep them, then I could easily run pyright on them in the next step.

MarcoGorelli commented 1 year ago

If I could generate those python files and keep them, then I could easily run pyright on them in the next step.

seems like a reasonable request - reopening then, thanks for the ping!

tqa236 commented 4 months ago

Hello, I would like to understand if this limitation also applies to mypy, which also needs the context of the whole codebase to correctly analyze the notebooks?