Skip to content

Commit bb64744

Browse files
authored
Merge branch 'main' into update-doubelstar
2 parents 0da0eee + 66a8b5b commit bb64744

File tree

131 files changed

+1084
-330
lines changed

Some content is hidden

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

131 files changed

+1084
-330
lines changed

.bazelci/presubmit.yml

Lines changed: 10 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
- "..."
@@ -55,6 +54,7 @@ buildifier:
5554
build_flags:
5655
- "--noenable_bzlmod"
5756
- "--enable_workspace"
57+
bazel: 7.x
5858
.common_bazelinbazel_config: &common_bazelinbazel_config
5959
build_flags:
6060
- "--build_tag_filters=integration-test"
@@ -159,7 +159,6 @@ tasks:
159159
- "--enable_workspace"
160160
- "--keep_going"
161161
- "--build_tag_filters=-integration-test"
162-
- "--config=bazel7.x"
163162
test_targets:
164163
- "--"
165164
- "..."
@@ -187,7 +186,6 @@ tasks:
187186
<<: *reusable_config
188187
name: "RBE: Ubuntu, minimum Bazel"
189188
platform: rbe_ubuntu2004
190-
bazel: 7.x
191189
build_flags:
192190
# BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1,
193191
# which prevents cc toolchain autodetection from working correctly
@@ -206,6 +204,9 @@ tasks:
206204
<<: *reusable_config
207205
name: "RBE: Ubuntu"
208206
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
209210
test_flags:
210211
- "--test_tag_filters=-integration-test,-acceptance-test"
211212
- "--extra_toolchains=@buildkite_config//config:cc-toolchain"
@@ -412,25 +413,21 @@ tasks:
412413
name: "examples/pip_parse_vendored: Ubuntu, workspace, minimum Bazel"
413414
working_directory: examples/pip_parse_vendored
414415
platform: ubuntu2004
415-
integration_test_pip_parse_vendored_ubuntu_min_bzlmod:
416-
<<: *minimum_supported_version
417-
<<: *reusable_build_test_all
418-
name: "examples/pip_parse_vendored: Ubuntu, bzlmod, minimum Bazel"
419-
working_directory: examples/pip_parse_vendored
420-
platform: ubuntu2004
421-
bazel: 7.x
422416
integration_test_pip_parse_vendored_ubuntu:
423417
<<: *reusable_build_test_all
418+
<<: *common_workspace_flags
424419
name: "examples/pip_parse_vendored: Ubuntu"
425420
working_directory: examples/pip_parse_vendored
426421
platform: ubuntu2004
427422
integration_test_pip_parse_vendored_debian:
428423
<<: *reusable_build_test_all
424+
<<: *common_workspace_flags
429425
name: "examples/pip_parse_vendored: Debian"
430426
working_directory: examples/pip_parse_vendored
431427
platform: debian11
432428
integration_test_pip_parse_vendored_macos:
433429
<<: *reusable_build_test_all
430+
<<: *common_workspace_flags
434431
name: "examples/pip_parse_vendored: MacOS"
435432
working_directory: examples/pip_parse_vendored
436433
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: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,43 @@ 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.
5558
* (deps) doublestar 4.7.1 (required for recent Gazelle versions)
5659

5760
{#v0-0-0-fixed}
5861
### Fixed
59-
* Nothing fixed.
62+
* (py_wheel) Use the default shell environment when building wheels to allow
63+
toolchains that search PATH to be used for the wheel builder tool.
64+
* (pypi) The requirement argument parsed to `whl_library` will now not have env
65+
marker information allowing `bazel query` to work in cases where the `whl` is
66+
available for all of the platforms and the sdist can be built. This fix is
67+
for both WORKSPACE and `bzlmod` setups.
68+
Fixes [#2450](https://github.com/bazelbuild/rules_python/issues/2450).
69+
* (gazelle) Gazelle will now correctly parse Python3.12 files that use [PEP 695 Type
70+
Parameter Syntax][pep-695]. (#2396)
71+
* (pypi) Using {bzl:obj}`pip_parse.experimental_requirement_cycles` and
72+
{bzl:obj}`pip_parse.use_hub_alias_dependencies` together now works when
73+
using WORKSPACE files.
74+
75+
[pep-695]: https://peps.python.org/pep-0695/
6076

6177
{#v0-0-0-added}
6278
### Added
63-
* Nothing added.
79+
* (gazelle) Added `include_stub_packages` flag to `modules_mapping`. When set to `True`, this
80+
automatically includes corresponding stub packages for third-party libraries
81+
that are present and used (e.g., `boto3``boto3-stubs`), improving
82+
type-checking support.
83+
* (pypi) Freethreaded packages are now fully supported in the
84+
{obj}`experimental_index_url` usage or the regular `pip.parse` usage.
85+
To select the free-threaded interpreter in the repo phase, please use
86+
the documented [env](/environment-variables.html) variables.
87+
Fixes [#2386](https://github.com/bazelbuild/rules_python/issues/2386).
6488

6589
{#v0-0-0-removed}
6690
### Removed
67-
* Nothing removed.
91+
* `find_requirements` in `//python:defs.bzl` has been removed.
6892

6993
{#v1-0-0}
7094
## [1.0.0] - 2024-12-05
@@ -121,7 +145,7 @@ Other changes:
121145
* (repositories): Add libs/python3.lib and pythonXY.dll to the `libpython` target
122146
defined by a repository template. This enables stable ABI builds of Python extensions
123147
on Windows (by defining Py_LIMITED_API).
124-
* (rules) `py_test` and `py_binary` targets no longer incorrectly remove the
148+
* (rules) `py_test` and `py_binary` targets no longer incorrectly remove the
125149
first `sys.path` entry when using {obj}`--bootstrap_impl=script`
126150

127151
{#v1-0-0-added}

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)