Skip to content

Commit 501a75f

Browse files
committed
Merge branch 'main' of https://github.com/bazel-contrib/rules_python into venv.site.packages
2 parents 5462793 + 1f8659c commit 501a75f

Some content is hidden

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

58 files changed

+2632
-550
lines changed

.bazelci/presubmit.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,10 @@ buildifier:
7878
coverage_targets:
7979
- //tests:my_lib_3_10_test
8080
- //tests:my_lib_3_11_test
81-
- //tests:my_lib_3_8_test
8281
- //tests:my_lib_3_9_test
8382
- //tests:my_lib_default_test
8483
- //tests:version_3_10_test
8584
- //tests:version_3_11_test
86-
- //tests:version_3_8_test
8785
- //tests:version_3_9_test
8886
- //tests:version_default_test
8987
tasks:

CHANGELOG.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,42 @@ Unreleased changes template.
5353

5454
{#v0-0-0-changed}
5555
### Changed
56-
* (toolchains) Use the latest astrahl-sh toolchain release [20250317] for Python versions:
56+
* (toolchain) The `exec` configuration toolchain now has the forwarded
57+
`exec_interpreter` now also forwards the `ToolchainInfo` provider. This is
58+
for increased compatibility with the `RBE` setups where access to the `exec`
59+
configuration interpreter is needed.
60+
* (toolchains) Use the latest astral-sh toolchain release [20250317] for Python versions:
5761
* 3.9.21
5862
* 3.10.16
5963
* 3.11.11
6064
* 3.12.9
6165
* 3.13.2
6266
* (pypi) Use `xcrun xcodebuild --showsdks` to find XCode root.
67+
* (pypi) The `bzlmod` extension will now generate smaller lock files for when
68+
using `experimental_index_url`.
69+
* (toolchains) Remove all but `3.8.20` versions of the Python `3.8` interpreter who has
70+
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.
6372

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

6675
{#v0-0-0-fixed}
6776
### Fixed
6877
* (runfiles) ({obj}`--bootstrap_impl=script`) Follow symlinks when searching for runfiles.
69-
* Do not try to run `chmod` when downloading non-windows hermetic toolchain
78+
* (toolchains) Do not try to run `chmod` when downloading non-windows hermetic toolchain
7079
repositories on Windows. Fixes
7180
[#2660](https://github.com/bazel-contrib/rules_python/issues/2660).
7281

7382
{#v0-0-0-added}
7483
### Added
84+
* (uv) A {obj}`lock` rule that is the replacement for the
85+
{obj}`compile_pip_requirements`. This may still have rough corners
86+
so please report issues with it in the
87+
[#1975](https://github.com/bazel-contrib/rules_python/issues/1975).
88+
Main highlights - the locking can be done within a build action or outside
89+
it, there is no more automatic `test` target (but it can be added on the user
90+
side by using `native_test`). For customizing the `uv` version that is used,
91+
please check the {obj}`uv.configure` tag class.
7592
* Add support for riscv64 linux platform.
7693
* (toolchains) Add python 3.13.2 and 3.12.9 toolchains
7794

@@ -113,14 +130,9 @@ Unreleased changes template.
113130

114131
{#v1-3-0-added}
115132
### Added
116-
* (providers) {obj}`PyInfo.site_packages_symlinks` field added to allow
117-
specifying links to create within the venv site packages
118-
(only applicable with {obj}`--bootstrap_impl=script`)
119-
([#2156](https://github.com/bazelbuild/rules_python/issues/2156)).
120-
* (rules) {obj}`py_library.site_packages_root` attribute added to allow
121-
specifying a library's sources follow a site-packages file layout.
122-
(only applicable with {obj}`--bootstrap_impl=script`)
123-
([#2156](https://github.com/bazelbuild/rules_python/issues/2156)).
133+
* (python) {attr}`python.defaults` has been added to allow users to
134+
set the default python version in the root module by reading the
135+
default version number from a file or an environment variable.
124136
* {obj}`//python/bin:python`: convenience target for directly running an
125137
interpreter. {obj}`--//python/bin:python_src` can be used to specify a
126138
binary whose interpreter to use.
@@ -144,6 +156,10 @@ Unreleased changes template.
144156
which allows pass arguments to the interpreter before the regular args.
145157
* (rules) Added {obj}`main_module` attribute to `py_binary` and `py_test`,
146158
which allows specifying a module name to run (i.e. `python -m <module>`).
159+
* (providers) (experimental) {obj}`PyInfo.site_packages_symlinks` field added to
160+
allow specifying links to create within the venv site packages (only
161+
applicable with {obj}`--bootstrap_impl=script`)
162+
([#2156](https://github.com/bazelbuild/rules_python/issues/2156)).
147163

148164
{#v1-3-0-removed}
149165
### Removed

docs/BUILD.bazel

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,12 @@ lock(
177177
name = "requirements",
178178
srcs = ["pyproject.toml"],
179179
out = "requirements.txt",
180-
upgrade = True,
181-
visibility = ["//private:__pkg__"],
180+
args = [
181+
"--emit-index-url",
182+
"--universal",
183+
"--upgrade",
184+
],
185+
visibility = ["//:__subpackages__"],
182186
)
183187

184188
# Temporary compatibility aliases for some other projects depending on the old

docs/requirements.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ babel==2.17.0 \
1818
--hash=sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d \
1919
--hash=sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2
2020
# via sphinx
21-
certifi==2024.8.30 \
22-
--hash=sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8 \
23-
--hash=sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9
21+
certifi==2025.1.31 \
22+
--hash=sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651 \
23+
--hash=sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe
2424
# via requests
2525
charset-normalizer==3.4.0 \
2626
--hash=sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621 \
@@ -242,9 +242,9 @@ packaging==24.1 \
242242
# via
243243
# readthedocs-sphinx-ext
244244
# sphinx
245-
pygments==2.18.0 \
246-
--hash=sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199 \
247-
--hash=sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a
245+
pygments==2.19.1 \
246+
--hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \
247+
--hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c
248248
# via sphinx
249249
pyyaml==6.0.2 \
250250
--hash=sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff \
@@ -328,9 +328,9 @@ sphinx-autodoc2==0.5.0 \
328328
--hash=sha256:7d76044aa81d6af74447080182b6868c7eb066874edc835e8ddf810735b6565a \
329329
--hash=sha256:e867013b1512f9d6d7e6f6799f8b537d6884462acd118ef361f3f619a60b5c9e
330330
# via rules-python-docs (docs/pyproject.toml)
331-
sphinx-reredirects==0.1.5 \
332-
--hash=sha256:444ae1438fba4418242ca76d6a6de3eaee82aaf0d8f2b0cac71a15d32ce6eba2 \
333-
--hash=sha256:cfa753b441020a22708ce8eb17d4fd553a28fc87a609330092917ada2a6da0d8
331+
sphinx-reredirects==0.1.6 \
332+
--hash=sha256:c491cba545f67be9697508727818d8626626366245ae64456fe29f37e9bbea64 \
333+
--hash=sha256:efd50c766fbc5bf40cd5148e10c00f2c00d143027de5c5e48beece93cc40eeea
334334
# via rules-python-docs (docs/pyproject.toml)
335335
sphinx-rtd-theme==3.0.1 \
336336
--hash=sha256:921c0ece75e90633ee876bd7b148cfaad136b481907ad154ac3669b6fc957916 \

examples/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@ lock(
2121
name = "bzlmod_requirements_3_9",
2222
srcs = ["bzlmod/requirements.in"],
2323
out = "bzlmod/requirements_lock_3_9.txt",
24+
args = [
25+
"--emit-index-url",
26+
"--universal",
27+
"--python-version=3.9",
28+
],
2429
python_version = "3.9.19",
2530
)

examples/bzlmod/requirements_lock_3_9.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ imagesize==1.4.1 \
4646
--hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \
4747
--hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a
4848
# via sphinx
49-
importlib-metadata==8.4.0 ; python_version < '3.10' \
49+
importlib-metadata==8.4.0 ; python_full_version < '3.10' \
5050
--hash=sha256:66f342cc6ac9818fc6ff340576acd24d65ba0b3efabb2b4ac08b598965a4a2f1 \
5151
--hash=sha256:9a547d3bc3608b025f93d403fdd1aae741c24fbb8314df4b155675742ce303c5
5252
# via sphinx
@@ -316,15 +316,15 @@ tabulate==0.9.0 \
316316
--hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \
317317
--hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f
318318
# via -r examples/bzlmod/requirements.in
319-
tomli==2.0.1 ; python_version < '3.11' \
319+
tomli==2.0.1 ; python_full_version < '3.11' \
320320
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
321321
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
322322
# via pylint
323323
tomlkit==0.11.6 \
324324
--hash=sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b \
325325
--hash=sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73
326326
# via pylint
327-
typing-extensions==4.12.2 ; python_version < '3.10' \
327+
typing-extensions==4.12.2 ; python_full_version < '3.10' \
328328
--hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
329329
--hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8
330330
# via
@@ -480,7 +480,7 @@ yamllint==1.28.0 \
480480
--hash=sha256:89bb5b5ac33b1ade059743cf227de73daa34d5e5a474b06a5e17fc16583b0cf2 \
481481
--hash=sha256:9e3d8ddd16d0583214c5fdffe806c9344086721f107435f68bad990e5a88826b
482482
# via -r examples/bzlmod/requirements.in
483-
zipp==3.20.0 ; python_version < '3.10' \
483+
zipp==3.20.0 ; python_full_version < '3.10' \
484484
--hash=sha256:0145e43d89664cfe1a2e533adc75adafed82fe2da404b4bbb6b026c0157bdb31 \
485485
--hash=sha256:58da6168be89f0be59beb194da1250516fdaa062ccebd30127ac65d30045e10d
486486
# via importlib-metadata

examples/multi_python_versions/MODULE.bazel

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ local_path_override(
1010
)
1111

1212
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
13-
python.toolchain(
14-
configure_coverage_tool = True,
15-
python_version = "3.8",
13+
python.defaults(
14+
# The environment variable takes precedence if set.
15+
python_version = "3.9",
16+
python_version_env = "BAZEL_PYTHON_VERSION",
1617
)
1718
python.toolchain(
1819
configure_coverage_tool = True,
@@ -36,11 +37,6 @@ use_repo(
3637

3738
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
3839
use_repo(pip, "pypi")
39-
pip.parse(
40-
hub_name = "pypi",
41-
python_version = "3.8",
42-
requirements_lock = "//requirements:requirements_lock_3_8.txt",
43-
)
4440
pip.parse(
4541
hub_name = "pypi",
4642
python_version = "3.9",

examples/multi_python_versions/WORKSPACE

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ python_register_multi_toolchains(
1515
name = "python",
1616
default_version = default_python_version,
1717
python_versions = [
18-
"3.8",
1918
"3.9",
2019
"3.10",
2120
"3.11",
@@ -31,13 +30,11 @@ multi_pip_parse(
3130
python_interpreter_target = {
3231
"3.10": "@python_3_10_host//:python",
3332
"3.11": "@python_3_11_host//:python",
34-
"3.8": "@python_3_8_host//:python",
3533
"3.9": "@python_3_9_host//:python",
3634
},
3735
requirements_lock = {
3836
"3.10": "//requirements:requirements_lock_3_10.txt",
3937
"3.11": "//requirements:requirements_lock_3_11.txt",
40-
"3.8": "//requirements:requirements_lock_3_8.txt",
4138
"3.9": "//requirements:requirements_lock_3_9.txt",
4239
},
4340
)

examples/multi_python_versions/requirements/BUILD.bazel

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
22

3-
compile_pip_requirements(
4-
name = "requirements_3_8",
5-
src = "requirements.in",
6-
python_version = "3.8",
7-
requirements_txt = "requirements_lock_3_8.txt",
8-
)
9-
103
compile_pip_requirements(
114
name = "requirements_3_9",
125
src = "requirements.in",

examples/multi_python_versions/requirements/requirements_lock_3_8.txt

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)