Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow installing python deps using pth files #13

Open
DolceTriade opened this issue Aug 30, 2023 · 1 comment · May be fixed by #14
Open

Allow installing python deps using pth files #13

DolceTriade opened this issue Aug 30, 2023 · 1 comment · May be fixed by #14

Comments

@DolceTriade
Copy link

Currently, rules_pyvenv installs all the python deps by symlinking them in site-packages. However, in bazel, the python deps are actually added to the PYTHONPATH, which means that for some deps, just symlinking into site-packages doesn't work.

However, venv supports this via pth files. Would it be feasible to add a flag to py_venv to also create a .pth file to append these deps to the PYTHONPATH as well?

DolceTriade added a commit to DolceTriade/rules_pyvenv that referenced this issue Aug 30, 2023
Currently, rules_pyvenv installs all the python deps by symlinking them in site-packages. However, in bazel, the python deps are actually added to the PYTHONPATH, which means that for some deps, just symlinking into site-packages doesn't work.

However, venv supports this via pth files. pth files will append the
directories specified in the pth file to the PYTHONPATH, which exhibits
the behavior we want.

Fixes cedarai#13
@DolceTriade DolceTriade linked a pull request Aug 30, 2023 that will close this issue
@alexeagle
Copy link

In https://github.com/aspect-build/rules_py we have this feature.

DolceTriade added a commit to DolceTriade/rules_pyvenv that referenced this issue Jan 30, 2024
Currently, rules_pyvenv installs all the python deps by symlinking them in site-packages. However, in bazel, the python deps are actually added to the PYTHONPATH, which means that for some deps, just symlinking into site-packages doesn't work.

However, venv supports this via pth files. pth files will append the
directories specified in the pth file to the PYTHONPATH, which exhibits
the behavior we want.

Fixes cedarai#13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants