Skip to content

fix: Fix bazel vendor support for requirements with environment markers #2997

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

Merged
merged 8 commits into from
Jun 22, 2025

Conversation

armandomontanez
Copy link
Contributor

@armandomontanez armandomontanez commented Jun 16, 2025

Fixes bazel vendor support for requirements files that contain environment markers. During a vendored bazel build, when evaluate_markers_py() is run it needs PYTHONHOME set to properly find the home of the vendored libraries.

Resolves #2996

Fixes `bazel vendor` support for requirements files that contain
environment markers. During a vendored `bazel build`, when
evaluate_markers_py() is run it needs PYTHONHOME set to properly find
the home of the vendored libraries.

Resolves (bazel-contrib#2996)
Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

To make it possible to merge this it would be great if you could add a changelog note.

Any reason why you are using pip_parse instead of bzlmod example? It already is using the env markers.

@@ -95,6 +97,7 @@ def evaluate_markers_py(mrctx, *, requirements, python_interpreter, python_inter
Label("@pypi__packaging//:BUILD.bazel"),
Label("//:BUILD.bazel"),
],
"PYTHONHOME": str(interpreter.dirname),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Solution LGTM in general.

@armandomontanez
Copy link
Contributor Author

To make it possible to merge this it would be great if you could add a changelog note.

Done.

Any reason why you are using pip_parse instead of bzlmod example? It already is using the env markers.

Ah, didn't realize that. Verified the bzlmod example reproduces the issue, and switched to just use that as the CI check.

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

Moved the CI config up to be next to other examples/bzlmod invocations.

@aignas aignas enabled auto-merge June 22, 2025 02:10
@aignas aignas disabled auto-merge June 22, 2025 02:10
@aignas aignas enabled auto-merge June 22, 2025 02:11
@aignas aignas added this pull request to the merge queue Jun 22, 2025
Merged via the queue into bazel-contrib:main with commit f6feca1 Jun 22, 2025
1 of 3 checks passed
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

Successfully merging this pull request may close these issues.

evaluate_markers_py() does not work with bazel vendor
2 participants