bazel-contrib / bazel-contrib/rules_uv

create_venv should use symlinks instead of hard copies

Open
#296 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
29
Forks
12
PR merge metrics
No merged PRs in 30d

Description

When you use `create_venv`, the files in `/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](https://github.com/cedarai/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*

```

Contributor guide

Open the contributing guide

Research direction

Start by locating the create_venv implementation in rules_uv and inspect how dependency and local-target files are currently materialized. Compare its behavior with the linked rules_pyvenv examples, then verify that pip dependencies point into the Bazel cache and local targets point to source files, while preserving a usable virtual environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.