Skip to content

Commit ebc6640

Browse files
committed
Merge branch 'main' into release/1.7
2 parents 896c700 + f1e585f commit ebc6640

File tree

29 files changed

+371
-176
lines changed

29 files changed

+371
-176
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ test --test_output=errors
1616
# creating (possibly empty) __init__.py files and adding them to the srcs of
1717
# Python targets as required.
1818
build --incompatible_default_to_explicit_init_py
19+
build --//python/config_settings:incompatible_default_to_explicit_init_py=True
1920

2021
# Ensure ongoing compatibility with this flag.
2122
common --incompatible_disallow_struct_provider_syntax

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ END_UNRELEASED_TEMPLATE
8383
vendoring the `requirements.bzl` file, please re-vendor so that downstream is unaffected
8484
when the APIs get removed. If you need to customize the way the dependencies get
8585
evaluated, see [our docs](/pypi/download.html#customizing-requires-dist-resolution) on customizing `Requires-Dist` resolution.
86-
* (toolchains) Added Python versions 3.14.0, 3.13.8, 3.12.12, 3.11.14, 3.10.19, and 3.9.24
87-
from the [20251010] release.
86+
* (toolchains) Added Python versions 3.15.0a1, 3.14.0, 3.13.9, 3.12.12, 3.11.14, 3.10.19, and 3.9.24
87+
from the [20251014] release.
88+
* (deps) (bzlmod) Upgraded to `bazel-skylib` version
89+
[1.8.2](https://github.com/bazelbuild/bazel-skylib/releases/tag/1.8.2)
8890

89-
[20251010]: https://github.com/astral-sh/python-build-standalone/releases/tag/20251010
91+
[20251014]: https://github.com/astral-sh/python-build-standalone/releases/tag/20251014
9092

9193
{#v1-7-0-fixed}
9294
### Fixed
@@ -1980,4 +1982,4 @@ Breaking changes:
19801982
* (pip) Create all_data_requirements alias
19811983
* Expose Python C headers through the toolchain.
19821984

1983-
[0.24.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.24.0
1985+
[0.24.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.24.0

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module(
55
)
66

77
bazel_dep(name = "bazel_features", version = "1.21.0")
8-
bazel_dep(name = "bazel_skylib", version = "1.8.1")
8+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
99
bazel_dep(name = "rules_cc", version = "0.1.5")
1010
bazel_dep(name = "platforms", version = "0.0.11")
1111

docs/api/rules_python/python/config_settings/index.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,65 @@ This is a transition flag and will be removed in a subsequent release.
2424
::::
2525
:::
2626

27+
::::{bzl:flag} build_python_zip
28+
Controls if a `py_binary/py_test` output is a self-executable zipapp.
29+
30+
When enabled, the output of `py_binary` or `py_test` targets will be a
31+
self-executable zipapp.
32+
33+
:::{note}
34+
This affects _all_ `py_binary` and `py_test` targets in the build, not
35+
only the target(s) specified on the command line.
36+
:::
37+
38+
Values:
39+
* `true`
40+
* `false`
41+
42+
This flag replaces the Bazel builtin `--build_python_zip` flag.
43+
44+
:::{versionadded} VERSION_NEXT_FEATURE
45+
:::
46+
::::
47+
48+
::::{bzl:flag} experimental_python_import_all_repositories
49+
Controls whether repository directories are added to the import path.
50+
51+
When enabled, the top-level directories in the runfiles root directory (which
52+
are presumbed to be repository directories) are added to the Python import
53+
search path.
54+
55+
It's recommended to set this to **`false`** to avoid external dependencies
56+
unexpectedly interferring with import searching.
57+
58+
Values;
59+
* `true` (default)
60+
* `false`
61+
62+
This flag replaces the Bazel builtin
63+
`--experimental_python_import_all_repositories` flag.
64+
65+
:::{versionadded} VERSION_NEXT_FEATURE
66+
:::
67+
::::
68+
69+
::::{bzl:flag} python_path
70+
A fallback path to use for Python for particular legacy Windows-specific code paths.
71+
72+
Deprecated, do not use. This flag is largely a no-op and was replaced by
73+
toolchains. It only remains for some legacy Windows code-paths that will
74+
be removed.
75+
76+
This flag replaces the Bazel builtin `--python_path` flag.
77+
78+
:::{deprecated} VERSION_NEXT_FEATURE
79+
Use toolchains instead.
80+
:::
81+
82+
:::{versionadded} VERSION_NEXT_FEATURE
83+
:::
84+
::::
85+
2786
:::{bzl:flag} python_version
2887
Determines the default hermetic Python toolchain version. This can be set to
2988
one of the values that `rules_python` maintains.
@@ -33,6 +92,29 @@ one of the values that `rules_python` maintains.
3392
Parses the value of the `python_version` and transforms it into a `X.Y` value.
3493
:::
3594

95+
::::{bzl:flag} incompatible_default_to_explicit_init_py
96+
Controls if missing `__init__.py` files are generated or not.
97+
98+
If false, `py_binary` and `py_test` will, for every `*.py` and `*.so` file,
99+
create `__init__.py` files for the containing directory, and all parent
100+
directories, that do not already have an `__init__.py` file. If true, this
101+
behavior is disabled.
102+
103+
It's recommended to disable this behavior to avoid surprising import effects
104+
from directories being importable when they otherwise wouldn't be, and for
105+
how it can interfere with implicit namespace packages.
106+
107+
Values:
108+
* `true`: do not generate missing `__init__.py` files
109+
* `false` (default): generate missing `__init__.py` files
110+
111+
This flag replaces the Bazel builtin
112+
`--incompatible_default_to_explicit_init_py` flag.
113+
114+
:::{versionadded} VERSION_NEXT_FEATURE
115+
:::
116+
::::
117+
36118
:::{bzl:target} is_python_*
37119
config_settings to match Python versions
38120

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
extlinks = {
124124
"gh-issue": (f"https://github.com/bazel-contrib/rules_python/issues/%s", "#%s issue"),
125125
"gh-path": (f"https://github.com/bazel-contrib/rules_python/tree/main/%s", "%s"),
126-
"gh-pr": (f"https://github.com/bazel-contrib/rules_python/pulls/%s", "#%s PR"),
126+
"gh-pr": (f"https://github.com/bazel-contrib/rules_python/pull/%s", "#%s PR"),
127127
}
128128

129129
# --- MyST configuration

docs/howto/multi-platform-pypi-deps.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,16 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
163163
# A custom platform for CUDA on glibc linux
164164
pip.default(
165165
platform = "linux_x86_64_cuda12.9",
166-
os = "linux",
167-
cpu = "x86_64",
166+
arch_name = "x86_64",
167+
os_name = "linux",
168168
config_settings = ["@//:is_cuda_12_9"],
169169
)
170170

171171
# A custom platform for musl on linux
172172
pip.default(
173173
platform = "linux_aarch64_musl",
174-
os = "linux",
175-
cpu = "aarch64",
174+
os_name = "linux",
175+
arch_name = "aarch64",
176176
config_settings = ["@//:is_musl"],
177177
)
178178

examples/build_file_generation/WORKSPACE

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,7 @@ workspace(name = "build_file_generation_example")
77
# file. When the symbol is loaded you can use the rule.
88
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
99

10-
######################################################################
11-
# We need rules_go and bazel_gazelle, to build the gazelle plugin from source.
12-
# Setup instructions for this section are at
13-
# https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel
14-
# You may need to update the version of the rule, which is listed in the above
15-
# documentation.
16-
######################################################################
17-
18-
# Define an http_archive rule that will download the below ruleset,
19-
# test the sha, and extract the ruleset to you local bazel cache.
20-
21-
http_archive(
22-
name = "io_bazel_rules_go",
23-
sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a",
24-
urls = [
25-
"https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
26-
"https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
27-
],
28-
)
29-
30-
# Download the bazel_gazelle ruleset.
31-
http_archive(
32-
name = "bazel_gazelle",
33-
sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62",
34-
urls = [
35-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
36-
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
37-
],
38-
)
39-
40-
# Load rules_go ruleset and expose the toolchain and dep rules.
41-
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
42-
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
43-
44-
# go_rules_dependencies is a function that registers external dependencies
45-
# needed by the Go rules.
46-
# See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
47-
go_rules_dependencies()
48-
49-
# go_rules_dependencies is a function that registers external dependencies
50-
# needed by the Go rules.
51-
# See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
52-
go_register_toolchains(version = "1.21.13")
53-
54-
# The following call configured the gazelle dependencies, Go environment and Go SDK.
55-
gazelle_dependencies()
56-
57-
# Remaining setup is for rules_python.
10+
# Setup rules_python.
5811

5912
# DON'T COPY_PASTE THIS.
6013
# Our example uses `local_repository` to point to the HEAD version of rules_python.
@@ -124,6 +77,53 @@ load("@pip//:requirements.bzl", "install_deps")
12477
# Initialize repositories for all packages in requirements_lock.txt.
12578
install_deps()
12679

80+
######################################################################
81+
# We need rules_go and bazel_gazelle, to build the gazelle plugin from source.
82+
# Setup instructions for this section are at
83+
# https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel
84+
# You may need to update the version of the rule, which is listed in the above
85+
# documentation.
86+
######################################################################
87+
88+
# Define an http_archive rule that will download the below ruleset,
89+
# test the sha, and extract the ruleset to you local bazel cache.
90+
91+
http_archive(
92+
name = "io_bazel_rules_go",
93+
sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a",
94+
urls = [
95+
"https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
96+
"https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
97+
],
98+
)
99+
100+
# Download the bazel_gazelle ruleset.
101+
http_archive(
102+
name = "bazel_gazelle",
103+
sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62",
104+
urls = [
105+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
106+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz",
107+
],
108+
)
109+
110+
# Load rules_go ruleset and expose the toolchain and dep rules.
111+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
112+
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
113+
114+
# go_rules_dependencies is a function that registers external dependencies
115+
# needed by the Go rules.
116+
# See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
117+
go_rules_dependencies()
118+
119+
# go_rules_dependencies is a function that registers external dependencies
120+
# needed by the Go rules.
121+
# See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
122+
go_register_toolchains(version = "1.21.13")
123+
124+
# The following call configured the gazelle dependencies, Go environment and Go SDK.
125+
gazelle_dependencies()
126+
127127
# The rules_python gazelle extension has some third-party go dependencies
128128
# which we need to fetch in order to compile it.
129129
load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

gazelle/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ test --test_output=errors
77
# creating (possibly empty) __init__.py files and adding them to the srcs of
88
# Python targets as required.
99
build --incompatible_default_to_explicit_init_py
10+
build --@rules_python//python/config_settings:incompatible_default_to_explicit_init_py=True
1011

1112
# Windows makes use of runfiles for some rules
1213
build --enable_runfiles

gazelle/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module(
44
compatibility_level = 1,
55
)
66

7-
bazel_dep(name = "bazel_skylib", version = "1.6.1")
7+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
88
bazel_dep(name = "rules_python", version = "0.18.0")
99
bazel_dep(name = "rules_go", version = "0.55.1", repo_name = "io_bazel_rules_go")
1010
bazel_dep(name = "gazelle", version = "0.36.0", repo_name = "bazel_gazelle")

gazelle/WORKSPACE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@ workspace(name = "rules_python_gazelle_plugin")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5+
http_archive(
6+
name = "bazel_skylib",
7+
sha256 = "6e78f0e57de26801f6f564fa7c4a48dc8b36873e416257a92bbb0937eeac8446",
8+
urls = [
9+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.8.2/bazel-skylib-1.8.2.tar.gz",
10+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.8.2/bazel-skylib-1.8.2.tar.gz",
11+
],
12+
)
13+
14+
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
15+
16+
bazel_skylib_workspace()
17+
518
http_archive(
619
name = "io_bazel_rules_go",
720
sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a",

0 commit comments

Comments
 (0)