Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/api/rules_python/python/config_settings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ one of the values that `rules_python` maintains.
Parses the value of the `python_version` and transforms it into a `X.Y` value.
:::

:::{bzl:target} is_python_*
config_settings to match Python versions

The name pattern is `is_python_X.Y` (to match major.minor) and `is_python_X.Y.Z`
(to match major.minor.patch).

Note that the set of available versions depends on the configured `TOOL_VERSIONS`.
Versions may not always be available if the root module has customized them, or
as older Python versions are removed from rules_python's set of known versions.

If you need to match a version that isn't present, you can manually define
a `config_setting` and have it match `python_version` or
`python_version_major_minor`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

New versions can be added via python.single_override, so it would be best to do that instead and then the config setting values will be updated. I think we should call out that for bzlmod this is only needed if users are configuring/registering their own toolchains.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the text to mention both options. The main case I have in mind is for non-root modules: they may want to define their own to insulate themselves from what a root module might do. The other main case is for unreleased versions or, yes, customized toolchains.

:::

::::{bzl:flag} exec_tools_toolchain
Determines if the {obj}`exec_tools_toolchain_type` toolchain is enabled.

Expand Down