Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(pypi): call python --version before marker eval #2819

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

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Apr 24, 2025

bzlmod has the full python version information statically and we don't
need to call Python to get its version, but for WORKSPACE that is not
the case and we have to call it before evaluating the markers in
universal requirements files.

This also fixes transitions in the compile_pip_requirements macro where
the .update target would not transition correctly based on the
python_version parameter.

Fixes #2818

`bzlmod` has the full python version information statically and we don't
need to call Python to get its version, but for `WORKSPACE` that is not
the case and we have to call it before evaluating the markers in
universal requirements files.

Fixes bazel-contrib#2818
@aignas aignas requested review from rickeylev and groodt as code owners April 24, 2025 13:13
@@ -1,10 +1,10 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.9
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this file should be generated with Python 3.10.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, it seems that the transition had a bug, so this PR will fix 2 bugs at once :D

@aignas aignas mentioned this pull request Apr 24, 2025
3 tasks
@rickeylev rickeylev added this pull request to the merge queue Apr 24, 2025
Merged via the queue into bazel-contrib:main with commit ee34409 Apr 24, 2025
3 checks passed
rickeylev pushed a commit that referenced this pull request Apr 24, 2025
`bzlmod` has the full python version information statically and we don't
need to call Python to get its version, but for `WORKSPACE` that is not
the case and we have to call it before evaluating the markers in
universal requirements files.

This also fixes transitions in the `compile_pip_requirements` macro
where
the `.update` target would not transition correctly based on the
`python_version` parameter.

Fixes #2818

(cherry picked from commit ee34409)
@aignas aignas deleted the fix/get-python-version-in-pip-repository branch April 24, 2025 21:50
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.

Error: key "python_version" not found in dictionary
3 participants