Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ END_UNRELEASED_TEMPLATE
* (bootstrap) For {obj}`--bootstrap_impl=system_python`, the sys.path order has
changed from `[app paths, stdlib, runtime site-packages]` to `[stdlib, app
paths, runtime site-packages]`.
* If using the (deprecated) autodetecting/runtime_env toolchain, then the Python
version specified at build-time *must* match the Python version used at
runtime (the {obj}`--@rules_python//python/config_settings:python_version`
flag and the {attr}`python_version` attribute control the build-time version
for a target). If they don't match, dependencies won't be importable. (Such a
misconfiguration was unlikely to work to begin with; this is called out as an
FYI).
* (rules) {obj}`--bootstrap_impl=script` is the default for non-Windows for bazel 8 and above.

{#v0-0-0-fixed}
### Fixed
Expand Down
11 changes: 10 additions & 1 deletion docs/api/rules_python/python/config_settings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,12 @@ Values:
::::{bzl:flag} bootstrap_impl
Determine how programs implement their startup process.

The default for this depends on the platform:
* Windows: `system_python` (**always** used)
* Other: `script`

Values:
* `system_python`: (default) Use a bootstrap that requires a system Python available
* `system_python`: Use a bootstrap that requires a system Python available
in order to start programs. This requires
{obj}`PyRuntimeInfo.bootstrap_template` to be a Python program.
* `script`: Use a bootstrap that uses an arbitrary executable script (usually a
Expand All @@ -269,6 +273,11 @@ instead.
:::{versionadded} 0.33.0
:::

:::{versionchanged} VERSION_NEXT_FEATURE
* The default for non-Windows changed from `system_python` to `script`.
* On Windows, the value is forced to `system_python`.
:::

::::

::::{bzl:flag} current_config
Expand Down
3 changes: 2 additions & 1 deletion python/config_settings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ load(
"VenvsUseDeclareSymlinkFlag",
rp_string_flag = "string_flag",
)
load("//python/private:util.bzl", "IS_BAZEL_8_OR_HIGHER")
load(
"//python/private/pypi:flags.bzl",
"UniversalWhlFlag",
Expand Down Expand Up @@ -90,7 +91,7 @@ string_flag(

rp_string_flag(
name = "bootstrap_impl",
build_setting_default = BootstrapImplFlag.SYSTEM_PYTHON,
build_setting_default = BootstrapImplFlag.SCRIPT if IS_BAZEL_8_OR_HIGHER else BootstrapImplFlag.SYSTEM_PYTHON,
override = select({
# Windows doesn't yet support bootstrap=script, so force disable it
":_is_windows": BootstrapImplFlag.SYSTEM_PYTHON,
Expand Down
3 changes: 3 additions & 0 deletions python/private/util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def define_bazel_6_provider(doc, fields, **kwargs):
return provider("Stub, not used", fields = []), None
return provider(doc = doc, fields = fields, **kwargs)

# Only bazel 8 can distinguish symlinks within the file depsets.
IS_BAZEL_8_OR_HIGHER = hasattr(config, "none")

IS_BAZEL_7_4_OR_HIGHER = hasattr(native, "legacy_globals")

IS_BAZEL_7_OR_HIGHER = hasattr(native, "starlark_doc_extract")
Expand Down