bazel-contrib / bazel-contrib/rules_python

pkg_zip creates the zip file with broken link inside venv

Open
#3,545 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
688
Forks
721
Avg merge
15h 7m
Merged PRs (30d)
76

Description

Using latest rules_python 1.8.2 (venv enabled) and rules_pkg 1.2.0

```
py_binary(
name = "app",
...
)

pkg_zip(
name = "app_zip",
srcs = [":app"],
include_runfiles = True,
)
```

When I unzip the app_zip.zip file, I can see all the symlinks inside app.runfiles/_main/utils/_app.venv are broken. They all have one extra ../

I checked unzipped directory structure, those rules_python++pip* directories are wrongly located inside app.runfiles/_main/ while on the build host bazel-bin, they are directly inside app.runfiles, parallel to _main. This caused all symlinks in venv broken.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown py_binary and pkg_zip targets using rules_python 1.8.2 and rules_pkg 1.2.0. Compare the extracted app.runfiles layout with bazel-bin, focusing on the rules_python++pip directories and symlink targets under _main/utils/_app.venv. Done means the archive preserves the expected layout and the virtual-environment symlinks resolve after extraction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.