Skip to content

Commit 8a39422

Browse files
committed
Merge branch 'main' into feat/starlark-env-marker-and-metadata-parsing
2 parents c4b08ad + 34e433b commit 8a39422

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1435
-692
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
55
# To update these lines, execute
66
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
7-
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered
8-
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered
7+
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
8+
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
99

1010
test --test_output=errors
1111

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ Unreleased changes template.
6868
using `experimental_index_url`.
6969
* (toolchains) Remove all but `3.8.20` versions of the Python `3.8` interpreter who has
7070
reached EOL. If users still need other versions of the `3.8` interpreter, please supply
71-
the URLs manually {bzl:ob}`python.toolchain` or {bzl:obj}`python_register_toolchains` calls.
71+
the URLs manually {bzl:obj}`python.toolchain` or {bzl:obj}`python_register_toolchains` calls.
72+
* (toolchains) Previously [#2636](https://github.com/bazel-contrib/rules_python/pull/2636)
73+
changed the semantics of `ignore_root_user_error` from "ignore" to "warning". This is now
74+
flipped back to ignoring the issue, and will only emit a warning when the attribute is set
75+
`False`.
76+
* (pypi) The PyPI extension will no longer write the lock file entries as the
77+
extension has been marked reproducible.
78+
Fixes [#2434](https://github.com/bazel-contrib/rules_python/issues/2434).
7279

7380
[20250317]: https://github.com/astral-sh/python-build-standalone/releases/tag/20250317
7481

@@ -78,9 +85,12 @@ Unreleased changes template.
7885
* (toolchains) Do not try to run `chmod` when downloading non-windows hermetic toolchain
7986
repositories on Windows. Fixes
8087
[#2660](https://github.com/bazel-contrib/rules_python/issues/2660).
88+
* (logging) Allow repo rule logging level to be set to `FAIL` via the `RULES_PYTHON_REPO_DEBUG_VERBOSITY` environment variable.
8189
* (toolchains) The toolchain matching is has been fixed when writing
8290
transitions transitioning on the `python_version` flag.
8391
Fixes [#2685](https://github.com/bazel-contrib/rules_python/issues/2685).
92+
* (toolchains) Run the check on the Python interpreter in isolated mode, to ensure it's not affected by userland environment variables, such as `PYTHONPATH`.
93+
* (toolchains) Ensure temporary `.pyc` and `.pyo` files are also excluded from the interpreters repository files.
8494

8595
{#v0-0-0-added}
8696
### Added
@@ -102,6 +112,14 @@ Unreleased changes template.
102112
please check the {obj}`uv.configure` tag class.
103113
* Add support for riscv64 linux platform.
104114
* (toolchains) Add python 3.13.2 and 3.12.9 toolchains
115+
* (providers) (experimental) {obj}`PyInfo.site_packages_symlinks` field added to
116+
allow specifying links to create within the venv site packages (only
117+
applicable with {obj}`--bootstrap_impl=script`)
118+
([#2156](https://github.com/bazelbuild/rules_python/issues/2156)).
119+
* (toolchains) Local Python installs can be used to create a toolchain
120+
equivalent to the standard toolchains. See [Local toolchains] docs for how to
121+
configure them.
122+
105123

106124
{#v0-0-0-removed}
107125
### Removed

MODULE.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ bazel_dep(name = "rules_shell", version = "0.3.0", dev_dependency = True)
8585
bazel_dep(name = "rules_multirun", version = "0.9.0", dev_dependency = True)
8686
bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
8787
bazel_dep(name = "rules_pkg", version = "1.0.1", dev_dependency = True)
88+
bazel_dep(name = "other", version = "0", dev_dependency = True)
8889

8990
# Extra gazelle plugin deps so that WORKSPACE.bzlmod can continue including it for e2e tests.
9091
# We use `WORKSPACE.bzlmod` because it is impossible to have dev-only local overrides.
@@ -106,6 +107,11 @@ local_path_override(
106107
path = "gazelle",
107108
)
108109

110+
local_path_override(
111+
module_name = "other",
112+
path = "tests/modules/other",
113+
)
114+
109115
dev_python = use_extension(
110116
"//python/extensions:python.bzl",
111117
"python",

docs/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ sphinx_stardocs(
8787
name = "bzl_api_docs",
8888
srcs = [
8989
"//python:defs_bzl",
90+
"//python:features_bzl",
9091
"//python:packaging_bzl",
9192
"//python:pip_bzl",
9293
"//python:py_binary_bzl",
@@ -107,6 +108,7 @@ sphinx_stardocs(
107108
"//python/cc:py_cc_toolchain_bzl",
108109
"//python/cc:py_cc_toolchain_info_bzl",
109110
"//python/entry_points:py_console_script_binary_bzl",
111+
"//python/local_toolchains:repos_bzl",
110112
"//python/private:attr_builders_bzl",
111113
"//python/private:builders_util_bzl",
112114
"//python/private:py_binary_rule_bzl",

docs/_includes/experimental_api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:::{warning}
2+
3+
**Experimental API.** This API is still under development and may change or be
4+
removed without notice.
5+
:::

docs/api/rules_python/python/config_settings/index.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ of builtin, known versions.
4646

4747
If you need to match a version that isn't present, then you have two options:
4848
1. Manually define a `config_setting` and have it match {obj}`--python_version`
49-
or {ob}`python_version_major_minor`. This works best when you don't control the
49+
or {obj}`python_version_major_minor`. This works best when you don't control the
5050
root module, or don't want to rely on the MODULE.bazel configuration. Such
5151
a config settings would look like:
5252
```
@@ -213,6 +213,23 @@ Values:
213213
::::
214214

215215

216+
::::
217+
218+
:::{flag} venvs_site_packages
219+
220+
Determines if libraries use a site-packages layout for their files.
221+
222+
Note this flag only affects PyPI dependencies of `--bootstrap_impl=script` binaries
223+
224+
:::{include} /_includes/experimental_api.md
225+
:::
226+
227+
228+
Values:
229+
* `no` (default): Make libraries importable by adding to `sys.path`
230+
* `yes`: Make libraries importable by creating paths in a binary's site-packages directory.
231+
::::
232+
216233
::::{bzl:flag} bootstrap_impl
217234
Determine how programs implement their startup process.
218235

docs/environment-variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ doing. This is mostly useful for development to debug errors.
101101
Determines the verbosity of logging output for repo rules. Valid values:
102102

103103
* `DEBUG`
104+
* `FAIL`
104105
* `INFO`
105106
* `TRACE`
106107
:::

0 commit comments

Comments
 (0)