aspect-build/rules_py

non-wheel external dependencies don't make it into the IDE venv

mattem opened this issue · 3 comments

If there is a dependency on an external py_library that isn't consumed via the py_wheel rule, eg it's a py_library generated by rules_python for a pip install, and referenced via the :pkg label, then when a venv is created for the test or binary target for IDE consumption, the dependency is missing from the venv, as the .pth file points to the path in the runfiles tree.

I have been able to verify this bug. For my use case, this is important because we rely on virtual environments for people's development environments and running some command line tools that have proven difficult to integrate into Bazel due to other bugs or missing features. In order to migrate a monorepo onto these rules, I would need to ensure that all of my dependencies were wheel dependencies, which requires explicitly annotating them in the pip_parse call. Since Starlark can't read files and you can't subclass dict(), there's not a clean way to do this with a traditional requirements.txt file.

Maybe already fixed...

I am still seeing this issue, I am creating a venv using py_venv and using pip_parse to install dependencies. If I move the venv into the runfiles then it is able to find the dependencies. This is due to the .pth file using relative paths from within the runfiles so when the .pth file is copied the relative paths no longer point to where the site packages are saved. Let me know if I am missing something.