Skip to content

Commit 548bd54

Browse files
committed
Merge branch 'main' into exp/pypi-simplify
2 parents 82e1532 + cab415d commit 548bd54

File tree

97 files changed

+997
-205
lines changed

Some content is hidden

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

97 files changed

+997
-205
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: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,21 @@ END_UNRELEASED_TEMPLATE
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 20250708 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
68+
* 3.14.0b4
6969
* (toolchain) Python 3.13 now references 3.13.5
7070
* (gazelle) Switched back to smacker/go-tree-sitter, fixing
7171
[#2630](https://github.com/bazel-contrib/rules_python/issues/2630)
7272
* (pypi) From now on the list of default platforms only includes `linux_x86_64`, `linux_aarch64`,
7373
`osx_x86_64`, `osx_aarch64` and `windows_x86_64`. If you are on other platforms, you need to
7474
use the `pip.default` to configure it yourself. If you are interested in graduating the
7575
platform, consider helping set us up CI for them and update the documentation.
76+
* (ci) We are now testing on Ubuntu 22.04 for RBE and non-RBE configurations.
77+
* (core) #!/usr/bin/env bash is now used as a shebang in the stage1 bootstrap template.
7678

7779
{#v0-0-0-fixed}
7880
### Fixed
@@ -94,6 +96,7 @@ END_UNRELEASED_TEMPLATE
9496
in ambiguous select matches ({gh-issue}`2759`) and should be much more efficient
9597
when running `bazel query` due to fewer repositories being included
9698
({gh-issue}`2849`).
99+
* Multi-line python imports (e.g. with escaped newlines) are now correctly processed by Gazelle.
97100

98101
{#v0-0-0-added}
99102
### Added
@@ -111,7 +114,14 @@ END_UNRELEASED_TEMPLATE
111114
* 3.11.13
112115
* 3.12.11
113116
* 3.13.5
114-
* 3.14.0b3
117+
* 3.14.0b4
118+
* (gazelle): New annotation `gazelle:include_pytest_conftest`. When not set (the
119+
default) or `true`, gazelle will inject any `conftest.py` file found in the same
120+
directory as a {obj}`py_test` target to that {obj}`py_test` target's `deps`.
121+
This behavior is unchanged from previous versions. When `false`, the `:conftest`
122+
dep is not added to the {obj}`py_test` target.
123+
* (gazelle) New directive `gazelle:python_generate_proto`; when `true`,
124+
Gazelle generates `py_proto_library` rules for `proto_library`. `false` by default.
115125

116126
{#v0-0-0-removed}
117127
### Removed

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");

docs/pypi/lock.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
:::{note}
77
Currently `rules_python` only supports `requirements.txt` format.
8+
9+
#{gh-issue}`2787` tracks `pylock.toml` support.
810
:::
911

1012
## requirements.txt
@@ -37,11 +39,33 @@ This rule generates two targets:
3739
Once you generate this fully specified list of requirements, you can install the requirements ([bzlmod](./download)/[WORKSPACE](./download-workspace)).
3840

3941
:::{warning}
40-
If you're specifying dependencies in `pyproject.toml`, make sure to include the `[build-system]` configuration, with pinned dependencies. `compile_pip_requirements` will use the build system specified to read your project's metadata, and you might see non-hermetic behavior if you don't pin the build system.
42+
If you're specifying dependencies in `pyproject.toml`, make sure to include the
43+
`[build-system]` configuration, with pinned dependencies.
44+
`compile_pip_requirements` will use the build system specified to read your
45+
project's metadata, and you might see non-hermetic behavior if you don't pin the
46+
build system.
4147

42-
Not specifying `[build-system]` at all will result in using a default `[build-system]` configuration, which uses unpinned versions ([ref](https://peps.python.org/pep-0518/#build-system-table)).
48+
Not specifying `[build-system]` at all will result in using a default
49+
`[build-system]` configuration, which uses unpinned versions
50+
([ref](https://peps.python.org/pep-0518/#build-system-table)).
4351
:::
4452

53+
54+
#### pip compile Dependency groups
55+
56+
pip-compile doesn't yet support pyproject.toml dependency groups. Follow
57+
[pip-tools #2062](https://github.com/jazzband/pip-tools/issues/2062)
58+
to see the status of their support.
59+
60+
In the meantime, support can be emulated by passing multiple files to `srcs`:
61+
62+
```starlark
63+
compile_pip_requirements(
64+
srcs = ["pyproject.toml", "requirements-dev.in"]
65+
...
66+
)
67+
```
68+
4569
### uv pip compile (bzlmod only)
4670

4771
We also have experimental setup for the `uv pip compile` way of generating lock files.

docs/readthedocs_build.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

33
set -eou pipefail
44

docs/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ babel==2.17.0 \
1717
--hash=sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d \
1818
--hash=sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2
1919
# via sphinx
20-
certifi==2025.6.15 \
21-
--hash=sha256:2e0c7ce7cb5d8f8634ca55d2ba7e6ec2689a2fd6537d8dec1296a477a4910057 \
22-
--hash=sha256:d747aa5a8b9bbbb1bb8c22bb13e22bd1f18e9796defa16bab421f7f7a317323b
20+
certifi==2025.7.14 \
21+
--hash=sha256:6b31f564a415d79ee77df69d757bb49a5bb53bd9f756cbbe24394ffd6fc1f4b2 \
22+
--hash=sha256:8ea99dbdfaaf2ba2f9bac77b9249ef62ec5218e7c2b2e903378ed5fccf765995
2323
# via requests
2424
charset-normalizer==3.4.2 \
2525
--hash=sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4 \

0 commit comments

Comments
 (0)