soniaai / rules_poetry

Bazel rules that use Poetry for Python package management
MIT License
73 stars 22 forks source link

poetry virtualenv python is not used #8

Open ruidc opened 3 years ago

ruidc commented 3 years ago

It's likely what is referred to in the TODOs, but how can I use this to execute the poetry virtualenv python instead of the platform python?

NathanHowell commented 3 years ago

@ruidc indeed, this repo doesn't have any Python toolchain support. if this is something you can help with we'd be happy to take a PR. for reference, we've been using (more or less) https://gist.github.com/NathanHowell/5cf4a353a8dd3a1025e682c4707d5bac to wire up a virtualenv toolchain specifically for Bazel.

it may be easy to get the Poetry venv path and use that instead, however the package layout used by rules_poetry does not match a standard venv. this was done to allow fine grained dependencies in Bazel sandboxes (only packages used by a target are in the PYTHONPATH), versus a standard venv where all packages will be available to all targets (regardless of deps). there may be a creative solution to get this behavior with a standard venv tho too, I just haven't found it yet.

ruidc commented 3 years ago

Thanks for the prompt reply - at the moment I'm still trying to understand the potential suitability of Bazel to our existing stack and have had no contact with Bazel (or poetry until recently). I did also find https://github.com/Mousius/rules_python_poetry and https://github.com/martinxsliu/rules_python_poetry and trying to cross compare.