Hi there, are there any instructions on setting up...
# general
p
Hi there, are there any instructions on setting up IDE intellisense for a Python repo managed by Pants? Our developers typically use vscode and PyCharm. Thanks
b
There's this page in the docs. https://www.pantsbuild.org/docs/setting-up-an-ide Do let us know if your devs runs into any difficulties.
šŸ‘ 3
p
Worked for me!
šŸ™Œ 1
f
For VSCode: By default, the VSCode Python extension looks for and loads a file namedĀ 
.env
Ā in the current workspace folder. For your convenience, this file can be part of the repository so that VSCode can understand where to look for sources when working in a monorepo consisting of multiple Python projects. It adjusts theĀ 
PYTHONPATH
Ā (https://code.visualstudio.com/docs/python/environments#_use-of-the-pythonpath-variable) variable adding all projects in the monorepo. Having this file makes it possible to jump to definition in the source code across multiple projects. It also makes the cross-projects refactoring possible. SetĀ 
python.venvPath
Ā in the application settings to point to the virtual environment created earlier (https://www.pantsbuild.org/docs/setting-up-an-ide#third-party-dependencies). The Python interpreter in the virtual environment youā€™ve specified will be used to run all Python applications in the VSCode workspace.
For PyCharm: If you are new to PyCharm, seeĀ Get startedĀ tutorial. ā€¢ Configure the Python interpreter to point to theĀ 
python
Ā executable in the virtual environment created earlier. SeeĀ Configure a virtual environmentĀ to learn more. ā€¢ Mark all directoriesĀ within the project asĀ 
Sources Root
Ā (can be done in batch by selecting multiple directories). Doing this will let you jump to definition in the source code and will make the cross-projects refactoring possible.
--- These are the instructions that work for our users šŸ™‚
šŸŒˆ 2
šŸ‘ 2
p
Thanks a lot Alexey!