Skip to content

[WIP] Bazel builds should be hermetic, but they're not - #1094

Open
kris524 wants to merge 1 commit into
quantumlib:mainfrom
kris524:pr-802
Open

[WIP] Bazel builds should be hermetic, but they're not#1094
kris524 wants to merge 1 commit into
quantumlib:mainfrom
kris524:pr-802

Conversation

@kris524

@kris524 kris524 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the size: S 10< lines changed <50 label Jul 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates rules_python into the WORKSPACE file to configure a hermetic Python 3.11 toolchain and manage pip dependencies. However, a critical Bazel loading error was identified because @python_3_11 is a toolchain repository and does not contain defs.bzl or expose an interpreter target. The reviewer provided a fix to reference @python_3_11_host//:python directly as the interpreter target.

Comment thread WORKSPACE
Comment on lines +59 to +70
load("@python_3_11//:defs.bzl", "interpreter")

# Parse locked requirements.
# pip_parse needs a lockfile, not a bare requirements.txt.
# We'll generate the lockfile in step 2.
load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
name = "pip",
python_interpreter_target = interpreter,
requirements_lock = "//:requirements_lock.txt",
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The repository @python_3_11 is a toolchain repository and does not contain a defs.bzl file or expose an interpreter target. Attempting to load from @python_3_11//:defs.bzl will cause a critical Bazel loading phase error, preventing any Bazel commands from running.

Instead, you should reference the hermetic interpreter target directly using @python_3_11_host//:python as the python_interpreter_target in pip_parse.

# Parse locked requirements.
# pip_parse needs a lockfile, not a bare requirements.txt.
# We'll generate the lockfile in step 2.
load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
    name = "pip",
    python_interpreter_target = "@python_3_11_host//:python",
    requirements_lock = "//:requirements_lock.txt",
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant