pyright-python icon indicating copy to clipboard operation
pyright-python copied to clipboard

pre-commit usage in VS Code devcontainer

Open olivercoleman-switchdin opened this issue 1 year ago • 1 comments

Love this, thank you! I have what must be a common use case, but I can't figure out how to make it work!

I want to use pyright in a pre-commit setup. I'm using a docker container (in a vs code devcontainer) instead of a venv. I tried following the instructions at https://github.com/RobertCraigie/pyright-python#pre-commit but this only describes how to handle dependencies installed in a venv. Because I'm using a docker container the dependencies are installed directly. I tried a few things with the extraPaths option for pyright but nothing seemed to work.

I don't know how to tell the pyright pre-commit hook how to find/include these dependencies.

olivercoleman-switchdin avatar Jul 26 '23 06:07 olivercoleman-switchdin

Figured out a solution. I had to set extraPaths=["<home dir>/.local/lib/python3.11/site-packages"] (replacing with actual home dir). Feels a bit hacky with absolute path containing home dir path and python version in there though.

olivercoleman-switchdin avatar Jul 26 '23 21:07 olivercoleman-switchdin