rules_python
rules_python copied to clipboard
Describe how to make python envs with all targets for IDE integration
🚀 feature request
Relevant Rules
Unknown
Description
I would like there to be a tool which is able to produce a valid venv such that IDEs can use it and resolve symbols for external python projects.
Describe the solution you'd like
If I depend on an external repository @third_party_dep//:dep, I wanna be able to control+click in my IDE (vscode or something) an go to the symbol at $(bazel info output_base)/external/third_party_dep/dep.py.
Describe alternatives you've considered
This is generally not an issue for pypi projects since I can make a venv from the list of requirements in my current workspace but I have no way to resolve bazel targets. So I know of no alternative.
https://github.com/cedarai/rules_pyvenv does what you want. I believe https://github.com/aspect-build/rules_py does as well.
I don't think https://github.com/aspect-build/rules_py does this but https://github.com/cedarai/rules_pyvenv might be useful if there was other tooling to query and install pure bazel python targets and their dependencies. The issue is not that the py_binary targets do or do not create venvs. It's that creating a "mega-venv" that includes pure Bazel targets is not something I see an existing solution for.
Maybe I don't understand what you mean by "pure Bazel targets", but rules_pyvenv will place any Bazel dep in the venv, not just those sourced from pip_install. For instance, if you have generated protobuf source, that gets placed in the venv so that code navigation works.
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!