Skip to content

Commit 33eaa93

Browse files
committed
Merge branch 'main' of https://github.com/bazel-contrib/rules_python into doc.misc.improvements
2 parents ffb3e13 + 537fe30 commit 33eaa93

File tree

216 files changed

+3738
-1554
lines changed

Some content is hidden

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

216 files changed

+3738
-1554
lines changed

.bazelci/presubmit.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,20 @@ tasks:
9191
<<: *common_workspace_flags_min_bazel
9292
<<: *minimum_supported_version
9393
name: "Gazelle: workspace, minimum supported Bazel version"
94-
platform: ubuntu2004
94+
platform: ubuntu2204
9595
build_targets: ["//..."]
9696
test_targets: ["//..."]
9797
working_directory: gazelle
9898
gazelle_extension_workspace:
9999
<<: *common_workspace_flags
100100
name: "Gazelle: workspace"
101-
platform: ubuntu2004
101+
platform: ubuntu2204
102102
build_targets: ["//..."]
103103
test_targets: ["//..."]
104104
working_directory: gazelle
105105
gazelle_extension:
106106
name: "Gazelle: default settings"
107-
platform: ubuntu2004
107+
platform: ubuntu2204
108108
build_targets: ["//..."]
109109
test_targets: ["//..."]
110110
working_directory: gazelle
@@ -114,28 +114,28 @@ tasks:
114114
<<: *reusable_config
115115
<<: *common_workspace_flags_min_bazel
116116
name: "Default: Ubuntu, workspace, minimum Bazel"
117-
platform: ubuntu2004
117+
platform: ubuntu2204
118118

119119
ubuntu_min_bzlmod:
120120
<<: *minimum_supported_version
121121
<<: *reusable_config
122122
name: "Default: Ubuntu, bzlmod, minimum Bazel"
123-
platform: ubuntu2004
123+
platform: ubuntu2204
124124
bazel: 7.x
125125
ubuntu:
126126
<<: *reusable_config
127127
name: "Default: Ubuntu"
128-
platform: ubuntu2004
128+
platform: ubuntu2204
129129
ubuntu_upcoming:
130130
<<: *reusable_config
131131
name: "Default: Ubuntu, upcoming Bazel"
132-
platform: ubuntu2004
132+
platform: ubuntu2204
133133
bazel: last_rc
134134
ubuntu_workspace:
135135
<<: *reusable_config
136136
<<: *common_workspace_flags
137137
name: "Default: Ubuntu, workspace"
138-
platform: ubuntu2004
138+
platform: ubuntu2204
139139
mac_workspace:
140140
<<: *reusable_config
141141
<<: *common_workspace_flags
@@ -185,7 +185,7 @@ tasks:
185185
<<: *minimum_supported_version
186186
<<: *reusable_config
187187
name: "RBE: Ubuntu, minimum Bazel"
188-
platform: rbe_ubuntu2004
188+
platform: rbe_ubuntu2204
189189
build_flags:
190190
# BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1,
191191
# which prevents cc toolchain autodetection from working correctly
@@ -203,7 +203,7 @@ tasks:
203203
rbe:
204204
<<: *reusable_config
205205
name: "RBE: Ubuntu"
206-
platform: rbe_ubuntu2004
206+
platform: rbe_ubuntu2204
207207
# TODO @aignas 2024-12-11: get the RBE working in CI for bazel 8.0
208208
# See https://github.com/bazelbuild/rules_python/issues/2499
209209
bazel: 7.x
@@ -217,13 +217,13 @@ tasks:
217217
<<: *common_workspace_flags_min_bazel
218218
name: "examples/build_file_generation: Ubuntu, workspace, minimum Bazel"
219219
working_directory: examples/build_file_generation
220-
platform: ubuntu2004
220+
platform: ubuntu2204
221221
integration_test_build_file_generation_ubuntu_workspace:
222222
<<: *reusable_build_test_all
223223
<<: *common_workspace_flags
224224
name: "examples/build_file_generation: Ubuntu, workspace"
225225
working_directory: examples/build_file_generation
226-
platform: ubuntu2004
226+
platform: ubuntu2204
227227
integration_test_build_file_generation_debian_workspace:
228228
<<: *reusable_build_test_all
229229
<<: *common_workspace_flags
@@ -249,21 +249,21 @@ tasks:
249249
coverage_targets: ["//:test"]
250250
name: "examples/bzlmod: Ubuntu, minimum Bazel"
251251
working_directory: examples/bzlmod
252-
platform: ubuntu2004
252+
platform: ubuntu2204
253253
bazel: 7.x
254254
integration_test_bzlmod_ubuntu:
255255
<<: *reusable_build_test_all
256256
<<: *coverage_targets_example_bzlmod
257257
name: "examples/bzlmod: Ubuntu"
258258
working_directory: examples/bzlmod
259-
platform: ubuntu2004
259+
platform: ubuntu2204
260260
bazel: 7.x
261261
integration_test_bzlmod_ubuntu_upcoming:
262262
<<: *reusable_build_test_all
263263
<<: *coverage_targets_example_bzlmod
264264
name: "examples/bzlmod: Ubuntu, upcoming Bazel"
265265
working_directory: examples/bzlmod
266-
platform: ubuntu2004
266+
platform: ubuntu2204
267267
bazel: last_rc
268268
integration_test_bzlmod_debian:
269269
<<: *reusable_build_test_all
@@ -276,7 +276,7 @@ tasks:
276276
<<: *reusable_build_test_all
277277
name: "examples/bzlmod: bazel vendor"
278278
working_directory: examples/bzlmod
279-
platform: ubuntu2004
279+
platform: ubuntu2204
280280
shell_commands:
281281
- "bazel vendor --vendor_dir=./vendor //..."
282282
- "bazel build --vendor_dir=./vendor //..."
@@ -316,19 +316,19 @@ tasks:
316316
<<: *coverage_targets_example_bzlmod_build_file_generation
317317
name: "examples/bzlmod_build_file_generation: Ubuntu, minimum Bazel"
318318
working_directory: examples/bzlmod_build_file_generation
319-
platform: ubuntu2004
319+
platform: ubuntu2204
320320
bazel: 7.x
321321
integration_test_bzlmod_generation_build_files_ubuntu:
322322
<<: *reusable_build_test_all
323323
<<: *coverage_targets_example_bzlmod_build_file_generation
324324
name: "examples/bzlmod_build_file_generation: Ubuntu"
325325
working_directory: examples/bzlmod_build_file_generation
326-
platform: ubuntu2004
326+
platform: ubuntu2204
327327
integration_test_bzlmod_generation_build_files_ubuntu_run:
328328
<<: *reusable_build_test_all
329329
name: "examples/bzlmod_build_file_generation: Ubuntu, Gazelle and pip"
330330
working_directory: examples/bzlmod_build_file_generation
331-
platform: ubuntu2004
331+
platform: ubuntu2204
332332
shell_commands:
333333
- "bazel run //:gazelle_python_manifest.update"
334334
- "bazel run //:gazelle -- update"
@@ -357,7 +357,7 @@ tasks:
357357
<<: *coverage_targets_example_multi_python
358358
name: "examples/multi_python_versions: Ubuntu, workspace"
359359
working_directory: examples/multi_python_versions
360-
platform: ubuntu2004
360+
platform: ubuntu2204
361361
integration_test_multi_python_versions_debian_workspace:
362362
<<: *reusable_build_test_all
363363
<<: *common_workspace_flags
@@ -386,19 +386,19 @@ tasks:
386386
<<: *reusable_build_test_all
387387
name: "examples/pip_parse: Ubuntu, workspace, minimum supported Bazel version"
388388
working_directory: examples/pip_parse
389-
platform: ubuntu2004
389+
platform: ubuntu2204
390390
integration_test_pip_parse_ubuntu_min_bzlmod:
391391
<<: *minimum_supported_version
392392
<<: *reusable_build_test_all
393393
name: "examples/pip_parse: Ubuntu, bzlmod, minimum supported Bazel version"
394394
working_directory: examples/pip_parse
395-
platform: ubuntu2004
395+
platform: ubuntu2204
396396
bazel: 7.x
397397
integration_test_pip_parse_ubuntu:
398398
<<: *reusable_build_test_all
399399
name: "examples/pip_parse: Ubuntu"
400400
working_directory: examples/pip_parse
401-
platform: ubuntu2004
401+
platform: ubuntu2204
402402
integration_test_pip_parse_debian:
403403
<<: *reusable_build_test_all
404404
name: "examples/pip_parse: Debian"
@@ -421,13 +421,13 @@ tasks:
421421
<<: *reusable_build_test_all
422422
name: "examples/pip_parse_vendored: Ubuntu, workspace, minimum Bazel"
423423
working_directory: examples/pip_parse_vendored
424-
platform: ubuntu2004
424+
platform: ubuntu2204
425425
integration_test_pip_parse_vendored_ubuntu:
426426
<<: *reusable_build_test_all
427427
<<: *common_workspace_flags
428428
name: "examples/pip_parse_vendored: Ubuntu"
429429
working_directory: examples/pip_parse_vendored
430-
platform: ubuntu2004
430+
platform: ubuntu2204
431431
integration_test_pip_parse_vendored_debian:
432432
<<: *reusable_build_test_all
433433
<<: *common_workspace_flags
@@ -450,7 +450,7 @@ tasks:
450450
<<: *common_workspace_flags
451451
name: "examples/py_proto_library: Ubuntu, workspace"
452452
working_directory: examples/py_proto_library
453-
platform: ubuntu2004
453+
platform: ubuntu2204
454454
integration_test_py_proto_library_debian_workspace:
455455
<<: *reusable_build_test_all
456456
<<: *common_workspace_flags
@@ -475,7 +475,7 @@ tasks:
475475
<<: *common_workspace_flags
476476
name: "examples/pip_repository_annotations: Ubuntu, workspace"
477477
working_directory: examples/pip_repository_annotations
478-
platform: ubuntu2004
478+
platform: ubuntu2204
479479
integration_test_pip_repository_annotations_debian_workspace:
480480
<<: *reusable_build_test_all
481481
<<: *common_workspace_flags
@@ -498,7 +498,7 @@ tasks:
498498
integration_test_bazelinbazel_ubuntu:
499499
<<: *common_bazelinbazel_config
500500
name: "tests/integration bazel-in-bazel: Ubuntu"
501-
platform: ubuntu2004
501+
platform: ubuntu2204
502502
integration_test_bazelinbazel_debian:
503503
<<: *common_bazelinbazel_config
504504
name: "tests/integration bazel-in-bazel: Debian"
@@ -508,7 +508,7 @@ tasks:
508508
<<: *reusable_build_test_all
509509
name: "compile_pip_requirements: Ubuntu"
510510
working_directory: tests/integration/compile_pip_requirements
511-
platform: ubuntu2004
511+
platform: ubuntu2204
512512
shell_commands:
513513
# Make a change to the locked requirements and then assert that //:requirements.update does the
514514
# right thing.
@@ -596,23 +596,23 @@ tasks:
596596
<<: *common_workspace_flags_min_bazel
597597
name: "compile_pip_requirements_test_from_external_repo: Ubuntu, workspace, minimum Bazel"
598598
working_directory: tests/integration/compile_pip_requirements_test_from_external_repo
599-
platform: ubuntu2004
599+
platform: ubuntu2204
600600
shell_commands:
601601
# Assert that @compile_pip_requirements//:requirements_test does the right thing.
602602
- "bazel test @compile_pip_requirements//..."
603603
integration_compile_pip_requirements_test_from_external_repo_ubuntu_min_bzlmod:
604604
<<: *minimum_supported_version
605605
name: "compile_pip_requirements_test_from_external_repo: Ubuntu, bzlmod, minimum Bazel"
606606
working_directory: tests/integration/compile_pip_requirements_test_from_external_repo
607-
platform: ubuntu2004
607+
platform: ubuntu2204
608608
bazel: 7.x
609609
shell_commands:
610610
# Assert that @compile_pip_requirements//:requirements_test does the right thing.
611611
- "bazel test @compile_pip_requirements//..."
612612
integration_compile_pip_requirements_test_from_external_repo_ubuntu:
613613
name: "compile_pip_requirements_test_from_external_repo: Ubuntu"
614614
working_directory: tests/integration/compile_pip_requirements_test_from_external_repo
615-
platform: ubuntu2004
615+
platform: ubuntu2204
616616
shell_commands:
617617
# Assert that @compile_pip_requirements//:requirements_test does the right thing.
618618
- "bazel test @compile_pip_requirements//..."

CHANGELOG.md

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,26 @@ END_UNRELEASED_TEMPLATE
5656
### Changed
5757
* (gazelle) For package mode, resolve dependencies when imports are relative
5858
to the package path. This is enabled via the
59-
`# gazelle:experimental_allow_relative_imports` true directive ({gh-issue}`2203`).
59+
`# gazelle:python_experimental_allow_relative_imports` true directive ({gh-issue}`2203`).
6060
* (gazelle) Types for exposed members of `python.ParserOutput` are now all public.
6161
* (gazelle) Removed the requirement for `__init__.py`, `__main__.py`, or `__test__.py` files to be
6262
present in a directory to generate a `BUILD.bazel` file.
63-
* (toolchain) Updated the following toolchains to build 20250702 to patch CVE-2025-47273:
63+
* (toolchain) Updated the following toolchains to build [20250808] to patch CVE-2025-47273:
6464
* 3.9.23
6565
* 3.10.18
6666
* 3.11.13
6767
* 3.12.11
68-
* 3.14.0b3
69-
* (toolchain) Python 3.13 now references 3.13.5
68+
* 3.14.0rc1
69+
* (toolchain) Python 3.13 now references 3.13.6
70+
* (gazelle) Switched back to smacker/go-tree-sitter, fixing
71+
[#2630](https://github.com/bazel-contrib/rules_python/issues/2630)
72+
* (ci) We are now testing on Ubuntu 22.04 for RBE and non-RBE configurations.
73+
* (core) `#!/usr/bin/env bash` is now used as a shebang in the stage1 bootstrap template.
74+
* (gazelle:docs) The Gazelle docs have been migrated from {gh-path}`gazelle/README.md` to
75+
{gh-path}`gazelle/docs` and are now available on the primary documentation site
76+
at https://rules-python.readthedocs.io/en/latest/gazelle/docs/index.html
77+
78+
[20250808]: https://github.com/astral-sh/python-build-standalone/releases/tag/20250808
7079

7180
{#v0-0-0-fixed}
7281
### Fixed
@@ -81,23 +90,55 @@ END_UNRELEASED_TEMPLATE
8190
([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)).
8291
* (toolchains) `local_runtime_repo` now checks if the include directory exists
8392
before attempting to watch it, fixing issues on macOS with system Python
84-
({gh-issue}`3043`).
93+
([#3043](https://github.com/bazel-contrib/rules_python/issues/3043)).
8594
* (pypi) The pipstar `defaults` configuration now supports any custom platform
8695
name.
96+
* Multi-line python imports (e.g. with escaped newlines) are now correctly processed by Gazelle.
97+
* (toolchains) `local_runtime_repo` works with multiarch Debian with Python 3.8
98+
([#3099](https://github.com/bazel-contrib/rules_python/issues/3099)).
99+
* (pypi) Expose pypi packages only common to all Python versions in `all_requirements`
100+
([#2921](https://github.com/bazel-contrib/rules_python/issues/2921)).
101+
* (repl) Normalize the path for the `REPL` stub to make it possible to use the
102+
default stub template from outside `rules_python` ({gh-issue}`3101`).
103+
* (gazelle) Fixes gazelle adding sibling module dependencies to resolve
104+
absolute imports (Python 2's behavior without `absolute_import`). Previous
105+
behavior can be restored using the directive
106+
`# gazelle:python_resolve_sibling_imports true`
107+
* (pypi) Show overridden index URL of packages when downloading metadata have failed.
108+
([#2985](https://github.com/bazel-contrib/rules_python/issues/2985)).
109+
* (toolchains) use "command -v" to find interpreter in `$PATH`
110+
([#3150](https://github.com/bazel-contrib/rules_python/pull/3150)).
111+
* (pypi) `bazel vendor` now works in `bzlmod` ({gh-issue}`3079`).
87112

88113
{#v0-0-0-added}
89114
### Added
115+
* (repl) Default stub now has tab completion, where `readline` support is available,
116+
see ([#3114](https://github.com/bazel-contrib/rules_python/pull/3114)).
117+
([#3114](https://github.com/bazel-contrib/rules_python/pull/3114)).
90118
* (pypi) To configure the environment for `requirements.txt` evaluation, use the newly added
91119
developer preview of the `pip.default` tag class. Only `rules_python` and root modules can use
92120
this feature. You can also configure custom `config_settings` using `pip.default`.
121+
* (pypi) PyPI dependencies now expose an `:extracted_whl_files` filegroup target
122+
of all the files extracted from the wheel. This can be used in lieu of
123+
{obj}`whl_filegroup` to avoid copying/extracting wheel multiple times to
124+
get a subset of their files.
93125
* (gazelle) New directive `gazelle:python_generate_pyi_deps`; when `true`,
94126
dependencies added to satisfy type-only imports (`if TYPE_CHECKING`) and type
95127
stub packages are added to `pyi_deps` instead of `deps`.
96128
* (toolchain) Add toolchains for aarch64 windows for
97129
* 3.11.13
98130
* 3.12.11
99-
* 3.13.5
100-
* 3.14.0b3
131+
* 3.13.6
132+
* 3.14.0rc1
133+
* (gazelle): New annotation `gazelle:include_pytest_conftest`. When not set (the
134+
default) or `true`, gazelle will inject any `conftest.py` file found in the same
135+
directory as a {obj}`py_test` target to that {obj}`py_test` target's `deps`.
136+
This behavior is unchanged from previous versions. When `false`, the `:conftest`
137+
dep is not added to the {obj}`py_test` target.
138+
* (gazelle) New directive `gazelle:python_generate_proto`; when `true`,
139+
Gazelle generates `py_proto_library` rules for `proto_library`. `false` by default.
140+
* (gazelle) New directive `gazelle:python_proto_naming_convention`; controls
141+
naming of `py_proto_library` rules.
101142

102143
{#v0-0-0-removed}
103144
### Removed

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,13 @@ merged:
234234
## Binary artifacts
235235

236236
Checking in binary artifacts is not allowed. This is because they are extremely
237-
problematic to verify and ensure they're safe
237+
problematic to verify and ensure they're safe. This is true even in
238+
test contexts.
238239

239240
Examples include, but aren't limited to: prebuilt binaries, shared libraries,
240241
zip files, or wheels.
241242

243+
See the dev guide for utilities to help with testing.
242244

243245
(breaking-changes)=
244246
## Breaking Changes

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig")
9595
# otherwise refer to RBE docs.
9696
rbe_preconfig(
9797
name = "buildkite_config",
98-
toolchain = "ubuntu1804-bazel-java11",
98+
toolchain = "ubuntu2204",
9999
)
100100

101101
local_repository(

addlicense.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# Copyright 2023 The Bazel Authors. All rights reserved.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)