Skip to content

Commit 3fb3236

Browse files
committed
Merge remote-tracking branch 'upstream/main' into HEAD
2 parents 314447d + 727ab43 commit 3fb3236

File tree

139 files changed

+1179
-632
lines changed

Some content is hidden

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

139 files changed

+1179
-632
lines changed

.bazelci/presubmit.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ buildifier:
1818
# Use a specific version to avoid skew issues when new versions are released.
1919
version: 6.1.0
2020
warnings: "all"
21-
# NOTE: Minimum supported version is 6.x for workspace; 7.x for bzlmod
21+
# NOTE: Minimum supported version is 7.x
2222
.minimum_supported_version: &minimum_supported_version
2323
# For testing minimum supported version.
2424
# NOTE: Keep in sync with //:version.bzl
25-
bazel: 6.4.0
26-
skip_in_bazel_downstream_pipeline: "Bazel 6 required"
25+
bazel: 7.x
26+
skip_in_bazel_downstream_pipeline: "Bazel 7 required"
2727
.reusable_config: &reusable_config
2828
build_targets:
2929
- "--"
@@ -34,7 +34,6 @@ buildifier:
3434
build_flags:
3535
- "--keep_going"
3636
- "--build_tag_filters=-integration-test"
37-
- "--config=bazel7.x"
3837
test_targets:
3938
- "--"
4039
- "..."
@@ -48,12 +47,14 @@ buildifier:
4847
- "--noenable_bzlmod"
4948
- "--test_tag_filters=-integration-test"
5049
.common_workspace_flags: &common_workspace_flags
50+
skip_in_bazel_downstream_pipeline: "Bazel 9 doesn't support workspace"
5151
test_flags:
5252
- "--noenable_bzlmod"
5353
- "--enable_workspace"
5454
build_flags:
5555
- "--noenable_bzlmod"
5656
- "--enable_workspace"
57+
bazel: 7.x
5758
.common_bazelinbazel_config: &common_bazelinbazel_config
5859
build_flags:
5960
- "--build_tag_filters=integration-test"
@@ -158,7 +159,6 @@ tasks:
158159
- "--enable_workspace"
159160
- "--keep_going"
160161
- "--build_tag_filters=-integration-test"
161-
- "--config=bazel7.x"
162162
test_targets:
163163
- "--"
164164
- "..."
@@ -186,7 +186,6 @@ tasks:
186186
<<: *reusable_config
187187
name: "RBE: Ubuntu, minimum Bazel"
188188
platform: rbe_ubuntu2004
189-
bazel: 7.x
190189
build_flags:
191190
# BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1,
192191
# which prevents cc toolchain autodetection from working correctly
@@ -205,6 +204,9 @@ tasks:
205204
<<: *reusable_config
206205
name: "RBE: Ubuntu"
207206
platform: rbe_ubuntu2004
207+
# TODO @aignas 2024-12-11: get the RBE working in CI for bazel 8.0
208+
# See https://github.com/bazelbuild/rules_python/issues/2499
209+
bazel: 7.x
208210
test_flags:
209211
- "--test_tag_filters=-integration-test,-acceptance-test"
210212
- "--extra_toolchains=@buildkite_config//config:cc-toolchain"
@@ -411,25 +413,21 @@ tasks:
411413
name: "examples/pip_parse_vendored: Ubuntu, workspace, minimum Bazel"
412414
working_directory: examples/pip_parse_vendored
413415
platform: ubuntu2004
414-
integration_test_pip_parse_vendored_ubuntu_min_bzlmod:
415-
<<: *minimum_supported_version
416-
<<: *reusable_build_test_all
417-
name: "examples/pip_parse_vendored: Ubuntu, bzlmod, minimum Bazel"
418-
working_directory: examples/pip_parse_vendored
419-
platform: ubuntu2004
420-
bazel: 7.x
421416
integration_test_pip_parse_vendored_ubuntu:
422417
<<: *reusable_build_test_all
418+
<<: *common_workspace_flags
423419
name: "examples/pip_parse_vendored: Ubuntu"
424420
working_directory: examples/pip_parse_vendored
425421
platform: ubuntu2004
426422
integration_test_pip_parse_vendored_debian:
427423
<<: *reusable_build_test_all
424+
<<: *common_workspace_flags
428425
name: "examples/pip_parse_vendored: Debian"
429426
working_directory: examples/pip_parse_vendored
430427
platform: debian11
431428
integration_test_pip_parse_vendored_macos:
432429
<<: *reusable_build_test_all
430+
<<: *common_workspace_flags
433431
name: "examples/pip_parse_vendored: MacOS"
434432
working_directory: examples/pip_parse_vendored
435433
platform: macos

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ examples/bzlmod_build_file_generation/bazel-bzlmod_build_file_generation
2222
examples/multi_python_versions/bazel-multi_python_versions
2323
examples/pip_parse/bazel-pip_parse
2424
examples/pip_parse_vendored/bazel-pip_parse_vendored
25+
examples/pip_repository_annotations/bazel-pip_repository_annotations
2526
examples/py_proto_library/bazel-py_proto_library
2627
tests/integration/compile_pip_requirements/bazel-compile_pip_requirements
2728
tests/integration/ignore_root_user_error/bazel-ignore_root_user_error

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ common --incompatible_disallow_struct_provider_syntax
2323
# Windows makes use of runfiles for some rules
2424
build --enable_runfiles
2525

26-
# Make Bazel 6 use bzlmod by default
26+
# Make Bazel 7 use bzlmod by default
2727
common --enable_bzlmod
2828

2929
# Additional config to use for readthedocs builds.
@@ -33,6 +33,6 @@ build:rtd --stamp
3333
# Some bzl files contain repos only available under bzlmod
3434
build:rtd --enable_bzlmod
3535

36-
common:bazel7.x --incompatible_python_disallow_native_rules
36+
common --incompatible_python_disallow_native_rules
3737

3838
build --lockfile_mode=update

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.x
1+
8.x

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ repos:
4646
- id: update-deleted-packages
4747
name: Update deleted packages
4848
language: system
49-
entry: bazel run @rules_bazel_integration_test//tools:update_deleted_packages
49+
# 7.x is necessary until https://github.com/bazel-contrib/rules_bazel_integration_test/pull/414
50+
# is merged and released
51+
entry: env USE_BAZEL_VERSION=7.x bazel run @rules_bazel_integration_test//tools:update_deleted_packages
5052
files: ^((examples|tests)/.*/(MODULE.bazel|WORKSPACE|WORKSPACE.bzlmod|BUILD.bazel)|.bazelrc)$
5153
pass_filenames: false

CHANGELOG.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,50 @@ Unreleased changes template.
5252

5353
{#v0-0-0-changed}
5454
### Changed
55+
* Bazel 6 support is dropped and Bazel 7.4.1 is the minimum supported
56+
version, per our Bazel support matrix. Earlier versions are not
57+
tested by CI, so functionality cannot be guaranteed.
58+
59+
{#v0-0-0-fixed}
60+
### Fixed
61+
* (py_wheel) Use the default shell environment when building wheels to allow
62+
toolchains that search PATH to be used for the wheel builder tool.
63+
* (pypi) The requirement argument parsed to `whl_library` will now not have env
64+
marker information allowing `bazel query` to work in cases where the `whl` is
65+
available for all of the platforms and the sdist can be built. This fix is
66+
for both WORKSPACE and `bzlmod` setups.
67+
Fixes [#2450](https://github.com/bazelbuild/rules_python/issues/2450).
68+
* (gazelle) Gazelle will now correctly parse Python3.12 files that use [PEP 695 Type
69+
Parameter Syntax][pep-695]. (#2396)
70+
* (pypi) Using {bzl:obj}`pip_parse.experimental_requirement_cycles` and
71+
{bzl:obj}`pip_parse.use_hub_alias_dependencies` together now works when
72+
using WORKSPACE files.
73+
74+
[pep-695]: https://peps.python.org/pep-0695/
75+
76+
{#v0-0-0-added}
77+
### Added
78+
* (gazelle) Added `include_stub_packages` flag to `modules_mapping`. When set to `True`, this
79+
automatically includes corresponding stub packages for third-party libraries
80+
that are present and used (e.g., `boto3``boto3-stubs`), improving
81+
type-checking support.
82+
* (pypi) Freethreaded packages are now fully supported in the
83+
{obj}`experimental_index_url` usage or the regular `pip.parse` usage.
84+
To select the free-threaded interpreter in the repo phase, please use
85+
the documented [env](/environment-variables.html) variables.
86+
Fixes [#2386](https://github.com/bazelbuild/rules_python/issues/2386).
87+
88+
{#v0-0-0-removed}
89+
### Removed
90+
* `find_requirements` in `//python:defs.bzl` has been removed.
91+
92+
{#v1-0-0}
93+
## [1.0.0] - 2024-12-05
94+
95+
[1.0.0]: https://github.com/bazelbuild/rules_python/releases/tag/1.0.0
96+
97+
{#v1-0-0-changed}
98+
### Changed
5599

56100
**Breaking**:
57101
* (toolchains) stop exposing config settings in python toolchain alias repos.
@@ -82,7 +126,7 @@ Other changes:
82126
* (deps) bazel_features 1.21.0; necessary for compatiblity with Bazel 8 rc3
83127
* (deps) stardoc 0.7.2 to support Bazel 8.
84128

85-
{#v0-0-0-fixed}
129+
{#v1-0-0-fixed}
86130
### Fixed
87131
* (toolchains) stop depending on `uname` to get the value of the host platform.
88132
* (pypi): Correctly handle multiple versions of the same package in the requirements
@@ -100,8 +144,10 @@ Other changes:
100144
* (repositories): Add libs/python3.lib and pythonXY.dll to the `libpython` target
101145
defined by a repository template. This enables stable ABI builds of Python extensions
102146
on Windows (by defining Py_LIMITED_API).
147+
* (rules) `py_test` and `py_binary` targets no longer incorrectly remove the
148+
first `sys.path` entry when using {obj}`--bootstrap_impl=script`
103149

104-
{#v0-0-0-added}
150+
{#v1-0-0-added}
105151
### Added
106152
* (gazelle): Parser failures will now be logged to the terminal. Additional
107153
details can be logged by setting `RULES_PYTHON_GAZELLE_VERBOSE=1`.
@@ -119,7 +165,7 @@ Other changes:
119165
initialize the interpreter via venv startup hooks.
120166
* (runfiles) (Bazel 7.4+) Added support for spaces and newlines in runfiles paths
121167

122-
{#v0-0-0-removed}
168+
{#v1-0-0-removed}
123169
### Removed
124170
* (pypi): Remove `pypi_install_dependencies` macro that has been included in
125171
{bzl:obj}`py_repositories` for a long time.

MODULE.bazel

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ dev_pip.parse(
121121
python_version = "3.11",
122122
requirements_lock = "//docs:requirements.txt",
123123
)
124+
dev_pip.parse(
125+
download_only = True,
126+
experimental_index_url = "https://pypi.org/simple",
127+
hub_name = "dev_pip",
128+
python_version = "3.13.0",
129+
requirements_lock = "//docs:requirements.txt",
130+
)
124131
dev_pip.parse(
125132
download_only = True,
126133
experimental_index_url = "https://pypi.org/simple",
@@ -143,8 +150,8 @@ bazel_binaries.local(
143150
name = "self",
144151
path = "tests/integration/bazel_from_env",
145152
)
146-
bazel_binaries.download(version = "6.4.0")
147-
bazel_binaries.download(version = "7.4.0")
153+
bazel_binaries.download(version = "7.4.1")
154+
bazel_binaries.download(version = "8.0.0")
148155

149156
# For now, don't test with rolling, because that's Bazel 9, which is a ways
150157
# away.
@@ -155,8 +162,8 @@ use_repo(
155162
# These don't appear necessary, but are reported as direct dependencies
156163
# that should be use_repo()'d, so we add them as requested
157164
"bazel_binaries_bazelisk",
158-
"build_bazel_bazel_6_4_0",
159-
"build_bazel_bazel_7_4_0",
165+
"build_bazel_bazel_7_4_1",
166+
"build_bazel_bazel_8_0_0",
160167
# "build_bazel_bazel_rolling",
161168
"build_bazel_bazel_self",
162169
)

WORKSPACE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,37 @@ workspace(name = "rules_python")
1717
# Everything below this line is used only for developing rules_python. Users
1818
# should not copy it to their WORKSPACE.
1919

20+
# Necessary so that Bazel 9 recognizes this as rules_python and doesn't try
21+
# to load the version Bazel itself uses by default.
22+
# buildifier: disable=duplicated-name
23+
local_repository(
24+
name = "rules_python",
25+
path = ".",
26+
)
27+
2028
load("//:internal_dev_deps.bzl", "rules_python_internal_deps")
2129

2230
rules_python_internal_deps()
2331

32+
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
33+
34+
rules_java_dependencies()
35+
36+
# note that the following line is what is minimally required from protobuf for the java rules
37+
# consider using the protobuf_deps() public API from @com_google_protobuf//:protobuf_deps.bzl
38+
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features") # buildifier: disable=bzl-visibility
39+
40+
proto_bazel_features(name = "proto_bazel_features")
41+
42+
# register toolchains
43+
load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
44+
45+
rules_java_toolchains()
46+
47+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
48+
49+
protobuf_deps()
50+
2451
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
2552

2653
rules_jvm_external_deps()

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Once you've imported the rule set using either Bzlmod or WORKSPACE, you can then
7676
load the core rules in your `BUILD` files with the following:
7777

7878
```starlark
79-
load("@rules_python//python:defs.bzl", "py_binary")
79+
load("@rules_python//python:py_binary.bzl", "py_binary")
8080

8181
py_binary(
8282
name = "main",

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ components have examples in the {gh-path}`examples` directory.
6767
The core rules are currently available in Bazel as built-in symbols, but this
6868
form is deprecated. Instead, you should depend on rules_python in your
6969
`WORKSPACE` or `MODULE.bazel` file and load the Python rules from
70-
`@rules_python//python:defs.bzl` or load paths described in the API documentation.
70+
`@rules_python//python:<name>.bzl` or load paths described in the API documentation.
7171

7272
A [buildifier](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md)
7373
fix is available to automatically migrate `BUILD` and `.bzl` files to add the

0 commit comments

Comments
 (0)