Skip to content

create_venv should use symlinks instead of hard copies #296

@baxelrod-bdai

Description

@baxelrod-bdai

When you use create_venv, the files in <venv>/lib/python3.10/site-packages are all physical copies of the dependencies. It would be much better if they were simply symlinks to the Bazel cache and source code. This makes it so that if you use F12 to "Go to definition" in an IDE, you can modify the actual code.

rules_pyvenv works this way:

pip dependencies point to the Bazel cache:

baxelrod@baxelrod-ThinkPad:~/repos/rai-bazel-sandbox/.venv/lib/python3.10/site-packages$ ll termcolor/termcolor.py 
lrwxrwxrwx 1 baxelrod baxelrod 158 Aug 27 10:49 termcolor/termcolor.py -> /home/baxelrod/.cache/bazel/_bazel_baxelrod/223f490fa0c2f2ec38707ddac3dd6272/external/rules_python++pip+pip_310_termcolor/site-packages/termcolor/termcolor.py

local targets point to the source code:

baxelrod@baxelrod-ThinkPad:~/repos/rai-bazel-sandbox/.venv/lib/python3.10/site-packages$ ll hello_lib.py 
lrwxrwxrwx 1 baxelrod baxelrod 61 Aug 27 10:49 hello_lib.py -> /home/baxelrod/repos/rai-bazel-sandbox/hello_lib/hello_lib.py*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions