Skip to content

wheel build is not hermetic #2713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gfrankliu opened this issue Mar 31, 2025 · 1 comment
Closed

wheel build is not hermetic #2713

gfrankliu opened this issue Mar 31, 2025 · 1 comment

Comments

@gfrankliu
Copy link

gfrankliu commented Mar 31, 2025

To reproduce

mkdir test
cd test
touch test_py.py
cat << EOF > BUILD
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("@third_party_lib//:requirements.bzl", "requirement")

compile_pip_requirements(
    name = "requirements",
    src = "requirements.in",
)

py_binary(
    name = "test_py",
    srcs = ["test_py.py"],
    deps = [requirement("pycocotools")],
)
EOF

cat <<EOF > MODULE.bazel
bazel_dep(name = "rules_python", version = "1.3.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
    is_default = True,
    python_version = "3.10",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
    enable_implicit_namespace_pkgs = True,
    extra_pip_args = ["--no-cache-dir"],
    hub_name = "third_party_lib",
    python_version = "3.10",
    requirements_lock = "//:requirements.txt",
)
use_repo(pip, "third_party_lib")
EOF

cat <<EOF > requirements.om
pycocotools==2.0.6
EOF

touch requirements.txt
bazel run //:requirements.update
bazel build //:test_py

Now I can see my username "gfrankliu" is embedded in the wheel:

$ strings bazel-bin/test_py.runfiles/rules_python~~pip~third_party_lib_310_pycocotools/site-packages/pycocotools/_mask.cpython-310-x86_64-linux-gnu.so | grep gfrankliu

/home/gfrankliu/.cache/bazel/_bazel_gfrankliu/0c06fba63a99dbe47301a331635af967/external/rules_python~~python~python_3_10_x86_64-unknown-linux-gnu/include/python3.10/cpython/abstract.h
@aignas
Copy link
Collaborator

aignas commented Mar 31, 2025

These are repository rules and are expected to be non-hermetic. Only extraction of the pre-existing wheel files is hermetic.

The plan to have hermetic builds is to move that to a build phase.

@aignas aignas closed this as completed Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants