Skip to content

[Question] - How do you acess the "@rules_python//python/cc:current_py_cc_headers" when working with multiple versions? #2157

Answered by rickeylev
tenspd137 asked this question in Q&A
Discussion options

You must be logged in to vote

To switch, set the command line or use a transition.

Command line: Set bazel build --@rules_python//python/config_settings:python_version=3.11 //my:pybind

Transition: Right now, the only easy way to use the transitions is through the e.g. 3.8.defs%py_binary wrappers. Ideally, py_package/py_wheel would let you set the version directly via an attribute (PRs welcome to add such functionality). Otherwise, you have to write your own wrapper rule to do the transition; you can look at python/config_settings/transition.bzl as an example (its what the py_binary wrappers use).

Note that you can only switch to a version that a toolchain has been declared for.

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tenspd137
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2132 on August 25, 2024 07:12.