Skip to content
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

feat(python.toolchain): support file-based default Python version #2588

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vonschultz
Copy link
Contributor

This change adds a new default_version_file attribute to python.toolchain. If set, the toolchain compares the file's contents to its python_version, and if they match, treats that toolchain as default (ignoring is_default). This allows Bazel to synchronize the default Python version with external tools (e.g., pyenv) that use a .python-version file or environment variables.

Fixes #2587.

This change adds a new `default_version_file` attribute to
`python.toolchain`. If set, the toolchain compares the file's contents
to its `python_version`, and if they match, treats that toolchain as
default (ignoring `is_default`). This allows Bazel to synchronize the
default Python version with external tools (e.g., pyenv) that use
a `.python-version` file or environment variables.

Fixes bazelbuild#2587.
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.

Support environment/file-based default Python version in python.toolchain
1 participant