Skip to content

Commit 5b8b528

Browse files
committed
Merge branch 'main' into aignas.feat.facts.sha.versions
2 parents a9e082e + 353e706 commit 5b8b528

92 files changed

Lines changed: 943 additions & 242 deletions

File tree

Some content is hidden

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

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ filegroup(
4343
"internal_dev_deps.bzl",
4444
"internal_dev_setup.bzl",
4545
"version.bzl",
46+
"//command_line_option:distribution",
4647
"//python:distribution",
4748
"//tools:distribution",
4849
],

CHANGELOG.md

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ BEGIN_UNRELEASED_TEMPLATE
4747
END_UNRELEASED_TEMPLATE
4848
-->
4949

50-
{#v0-0-0}
51-
## Unreleased
50+
{#v1-9-0}
51+
## [1.9.0] - 2026-02-21
5252

53-
[0.0.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.0.0
53+
[1.9.0]: https://github.com/bazel-contrib/rules_python/releases/tag/1.9.0
5454

55-
{#v0-0-0-removed}
55+
{#v1-9-0-removed}
5656
### Removed
5757
* Nothing removed.
5858

59-
{#v0-0-0-changed}
59+
{#v1-9-0-changed}
6060
### Changed
6161
* **DEPRECATED: implicit zipapp support**
6262
* Implicit zipapp output of `py_binary`/`py_test` has been deprecated and
@@ -69,18 +69,29 @@ END_UNRELEASED_TEMPLATE
6969
`//python/config_setting/...` and the `@platforms` package instead.
7070
* (binaries/tests) The `PYTHONBREAKPOINT` environment variable is automatically inherited
7171
* (binaries/tests) The {obj}`stamp` attribute now transitions the Bazel builtin
72-
{obj}`--stamp` flag.
72+
{flag}`--stamp` flag.
7373
* (pypi) Now the RECORD file patches will follow the quoted or unquoted filenames convention
7474
in order to make `pytorch` and friends easier to patch.
75-
76-
{#v0-0-0-fixed}
75+
* (wheel) `py_wheel` no longer expands the input depset during analysis,
76+
improving analysis performance for targets with large dependency trees.
77+
* (binaries/tests) (Windows) `--enable_runfiles=true` is the default for
78+
`py_binary/py_test`. Prior behavior can be restored by adding
79+
`@rules_python//command_line_option:enable_runfiles=false` or
80+
`@rules_python//command_line_option:enable_runfiles=INHERIT` to the
81+
`config_settings` attribute. NOTE: `enable_runfiles=true` will
82+
soon become **required for Windows**.
83+
84+
{#v1-9-0-fixed}
7785
### Fixed
7886
* (runfiles) Fixed `CurrentRepository()` raising `ValueError` on Windows.
7987
([#3579](https://github.com/bazel-contrib/rules_python/issues/3579))
8088
* (tests) No more coverage warnings are being printed if there are no sources.
8189
([#2762](https://github.com/bazel-contrib/rules_python/issues/2762))
8290
* (gazelle) Ancestor `conftest.py` files are added in addition to sibling `conftest.py`.
83-
([#3497](https://github.com/bazel-contrib/rules_python/issues/3497))
91+
([#3497](https://github.com/bazel-contrib/rules_python/issues/3497)) Note
92+
that this behavior can be reverted to the pre-1.9.0 behavior by setting the new
93+
`python_include_ancestor_conftest` directive to `false`.
94+
* (binaries/tests) Stamped build data generated by Windows actions is readable
8495
* (pypi) `pip_parse` no longer silently drops PEP 508 URL-based requirements
8596
(`pkg @ https://...`) when `extract_url_srcs=False` (the default for
8697
`pip_repository`).
@@ -89,14 +100,14 @@ END_UNRELEASED_TEMPLATE
89100
(e.g., `sqlalchemy[postgresql-psycopg2binary]`).
90101
([#3587](https://github.com/bazel-contrib/rules_python/issues/3587))
91102

92-
{#v0-0-0-added}
103+
{#v1-9-0-added}
93104
### Added
94105
* (binaries/tests) {obj}`--debugger`: allows specifying an extra dependency
95106
to add to binaries/tests for custom debuggers.
96107
* (binaries/tests) Build information is now included in binaries and tests.
97108
Use the `bazel_binary_info` module to access it. The {flag}`--stamp` flag will
98-
add {flag}`--workspace_status` information.
99-
* (gazelle) A new directive `python_generate_pyi_deps` has been added. When
109+
add {obj}`--workspace_status_command` information.
110+
* (gazelle) A new directive `python_generate_pyi_srcs` has been added. When
100111
`true`, a `py_*` target's `pyi_srcs` attribute will be set if any `.pyi` files
101112
that are associated with the target's `srcs` are present.
102113
([#3354](https://github.com/bazel-contrib/rules_python/issues/3354)).
@@ -113,10 +124,37 @@ END_UNRELEASED_TEMPLATE
113124
{obj}`PyExecutableInfo.venv_python_exe`.
114125
* (tools/wheelmaker.py) Added support for URL requirements according to PEP 508
115126
in Requires-Dist metadata. ([#3569](https://github.com/bazel-contrib/rules_python/pull/3569))
127+
* (gazelle) A new directive `python_include_ancestor_conftest` has been added.
128+
When `false`, ancestor `conftest` targets are not automatically added to
129+
{bzl:obj}`py_test` target dependencies. This `false` behavior is how things
130+
were in `rules_python` before 1.9.0. The default is `true`, as the prior behavior
131+
was technically incorrect.
132+
([#3596](https://github.com/bazel-contrib/rules_python/pull/3596))
133+
134+
135+
{#v1-8-5}
136+
## [1.8.5] - 2026-02-22
137+
138+
[1.8.5]: https://github.com/bazel-contrib/rules_python/releases/tag/1.8.5
139+
140+
{#v1-8-5-fixed}
141+
### Fixed
142+
* (runfiles) Fixed `CurrentRepository()` raising `ValueError` on Windows.
143+
([#3579](https://github.com/bazel-contrib/rules_python/issues/3579))
144+
* (pypi) `pip_parse` no longer silently drops PEP 508 URL-based requirements
145+
(`pkg @ https://...`) when `extract_url_srcs=False` (the default for
146+
`pip_repository`).
147+
* (pypi) Extras in requirement strings are now normalized per PEP 685,
148+
fixing missing transitive dependencies when extras contain hyphens
149+
(e.g., `sqlalchemy[postgresql-psycopg2binary]`).
150+
([#3587](https://github.com/bazel-contrib/rules_python/issues/3587))
116151

117152
{#v1-8-4}
118153
## [1.8.4] - 2026-02-10
119154

155+
[1.8.4]: https://github.com/bazel-contrib/rules_python/releases/tag/1.8.4
156+
157+
{#v1-8-4-fixed}
120158
### Fixed
121159
* (pipstar): A corner case of evaluation of version specifiers (`"1.2" ~= "1.2.0"`)
122160
has been fixed improving compatibility with the PEP440 standard.
@@ -128,6 +166,8 @@ END_UNRELEASED_TEMPLATE
128166
{#v1-8-3}
129167
## [1.8.3] - 2026-01-27
130168

169+
[1.8.3]: https://github.com/bazel-contrib/rules_python/releases/tag/1.8.3
170+
131171
{#v1-8-3-fixed}
132172
### Fixed
133173
* (pipstar) Fix whl extraction on Windows when bazelrc has XX flags.
@@ -136,6 +176,8 @@ END_UNRELEASED_TEMPLATE
136176
{#v1-8-2}
137177
## [1.8.2] - 2026-01-24
138178

179+
[1.8.2]: https://github.com/bazel-contrib/rules_python/releases/tag/1.8.2
180+
139181
{#v1-8-2-fixed}
140182
### Fixed
141183
* (venvs) relax the C library filename check to make tensorflow work
@@ -144,6 +186,8 @@ END_UNRELEASED_TEMPLATE
144186
{#v1-8-1}
145187
## [1.8.1] - 2026-01-20
146188

189+
[1.8.1]: https://github.com/bazel-contrib/rules_python/releases/tag/1.8.1
190+
147191
{#v1-8-1-fixed}
148192
### Fixed
149193
* (pipstar) Extra resolution that refers back to the package being resolved works again.
@@ -166,7 +210,7 @@ END_UNRELEASED_TEMPLATE
166210
to pass the `TOOL_VERSIONS` that include 3.8 toolchains or use the `bzlmod` APIs to add
167211
them back. This means any hub `pip.parse` calls that target `3.8` will be ignored from
168212
now on. ([#2704](https://github.com/bazel-contrib/rules_python/issues/2704))
169-
{object}`python.single_version_override`, like:
213+
{bzl:obj}`python.single_version_override`, like:
170214

171215
```starlark
172216
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
@@ -281,10 +325,10 @@ END_UNRELEASED_TEMPLATE
281325
[#2949](https://github.com/bazel-contrib/rules_python/issues/2949) if you run into any
282326
problems.
283327
With this release we are deprecating {obj}`pip.parse.experimental_target_platforms` and
284-
{obj}`pip_repository.experimental_target_platforms`. For users using `WORKSPACE` and
328+
`pip_repository.experimental_target_platforms`. For users using `WORKSPACE` and
285329
vendoring the `requirements.bzl` file, please re-vendor so that downstream is unaffected
286330
when the APIs get removed. If you need to customize the way the dependencies get
287-
evaluated, see [our docs](/pypi/download.html#customizing-requires-dist-resolution) on customizing `Requires-Dist` resolution.
331+
evaluated, see [our docs](https://rules-python.readthedocs.io/en/latest/pypi/download.html#customizing-requires-dist-resolution) on customizing `Requires-Dist` resolution.
288332
* (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
289333
from the [20251014] release.
290334
* (deps) (bzlmod) Upgraded to `bazel-skylib` version
@@ -364,7 +408,7 @@ END_UNRELEASED_TEMPLATE
364408
the right wheel when there are multiple wheels for the target platform
365409
(e.g. `musllinux_1_1_x86_64` and `musllinux_1_2_x86_64`). If the user
366410
wants to set the minimum version for the selection algorithm, use the
367-
{attr}`pip.defaults.whl_platform_tags` attribute to configure that. If
411+
{obj}`pip.default.whl_platform_tags` attribute to configure that. If
368412
`musllinux_*_x86_64` is specified, we will choose the lowest available
369413
wheel version. Fixes [#3250](https://github.com/bazel-contrib/rules_python/issues/3250).
370414

command_line_option/BUILD.bazel

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Special placeholders for Bazel builtin //command_line_option psuedo-targets
2+
#
3+
# These are special targets to use with `py_binary.config_settings` that are
4+
# treated as aliases for `//command_line_option:XXX` psuedo-targets. They
5+
# are not actual flags or have any value.
6+
7+
package(
8+
default_visibility = ["//visibility:public"],
9+
)
10+
11+
alias(
12+
name = "build_runfile_links",
13+
actual = "//python:none",
14+
)
15+
16+
alias(
17+
name = "enable_runfiles",
18+
actual = "//python:none",
19+
)
20+
21+
filegroup(
22+
name = "distribution",
23+
srcs = glob(["**"]),
24+
visibility = ["//:__subpackages__"],
25+
)

docs/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ sphinx_stardocs(
8989
"//python:features_bzl",
9090
"//python:packaging_bzl",
9191
"//python:pip_bzl",
92+
"//python:proto_bzl",
9293
"//python:py_binary_bzl",
9394
"//python:py_cc_link_params_info_bzl",
9495
"//python:py_exec_tools_info_bzl",
@@ -111,6 +112,7 @@ sphinx_stardocs(
111112
"//python/extensions:python_bzl",
112113
"//python/local_toolchains:repos_bzl",
113114
"//python/private:attr_builders_bzl",
115+
"//python/private:builders_bzl",
114116
"//python/private:builders_util_bzl",
115117
"//python/private:py_binary_rule_bzl",
116118
"//python/private:py_cc_toolchain_rule_bzl",

docs/_includes/py_console_script_binary.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ py_console_script_binary(
1212
)
1313
```
1414

15-
#### Specifying extra dependencies
15+
:::{rubric} Specifying extra dependencies
16+
:::
1617
You can also specify extra dependencies and the
1718
exact script name you want to call. This is useful for tools like `flake8`,
1819
`pylint`, and `pytest`, which have plugin discovery methods and discover
@@ -36,7 +37,8 @@ py_console_script_binary(
3637
)
3738
```
3839

39-
#### Using a specific Python version
40+
:::{rubric} Using a specific Python version
41+
:::
4042

4143
A specific Python version can be forced by passing the desired Python version, e.g. to force Python 3.9:
4244
```starlark
@@ -49,7 +51,8 @@ py_console_script_binary(
4951
)
5052
```
5153

52-
#### Adding a Shebang Line
54+
:::{rubric} Adding a Shebang Line
55+
:::
5356

5457
You can specify a shebang line for the generated binary. This is useful for Unix-like
5558
systems where the shebang line determines which interpreter is used to execute
@@ -69,7 +72,8 @@ Note that to execute via the shebang line, you need to ensure the specified
6972
Python interpreter is available in the environment.
7073

7174

72-
#### Using a specific Python Version directly from a Toolchain
75+
:::{rubric} Using a specific Python Version directly from a Toolchain
76+
:::
7377
:::{deprecated} 1.1.0
7478
The toolchain-specific `py_binary` and `py_test` symbols are aliases to the regular rules.
7579
For example, `load("@python_versions//3.11:defs.bzl", "py_binary")` and `load("@python_versions//3.11:defs.bzl", "py_test")` are deprecated.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
:::{default-domain} bzl
2+
:::
3+
:::{bzl:currentfile} //command_line_option:BUILD.bazel
4+
:::
5+
6+
# //command_line_option
7+
8+
This package provides special targets that correspond to the Bazel-builtin
9+
`//command_line_option` psuedo-targets. These can be used with the {obj}`config_settings`
10+
attribute on Python rules to transition specific command line flags for a target.
11+
12+
:::{note}
13+
These targets are not actual `alias()` targets, Starlark flags, nor are they the
14+
actual builtin command line flags. They are regular targets that the
15+
`config_settings` transition logic specially recognizes and handles as if they
16+
were the builtin `//command_line_option` psuedo-targets.
17+
:::
18+
19+
While this package only provides a subset of builtin Bazel flags, additional
20+
ones can be introduced by:
21+
22+
* Define your own `@foo//command_line_flag:<name>` target. It **must** be
23+
in a top-level `command_line_flag` directory.
24+
* Use {obj}`config.add_transition_setting` to make the rules transition on
25+
the corresponding `//command_line_option:<name>` builtin Bazel psuedo-target.
26+
27+
:::{seealso}
28+
The `config_settings` attribute documentation on:
29+
* {obj}`py_binary.config_settings`
30+
* {obj}`py_test.config_settings`
31+
:::
32+
33+
## build_runfile_links
34+
35+
:::{bzl:target} build_runfile_links
36+
37+
Special target for the Bazel-builtin `//command_line_option:build_runfile_links` flag.
38+
39+
See the [Bazel documentation for --build_runfile_links](https://bazel.build/reference/command-line-reference#flag--build_runfile_links).
40+
41+
The special value `INHERIT` can be specified to use the existing flag value.
42+
:::
43+
44+
## enable_runfiles
45+
46+
:::{bzl:target} enable_runfiles
47+
48+
Special target for the Bazel-builtin `//command_line_option:enable_runfiles` flag.
49+
50+
See the [Bazel documentation for --enable_runfiles](https://bazel.build/reference/command-line-reference#flag--enable_runfiles).
51+
52+
The special value `INHERIT` can be specified to use the existing flag value.
53+
:::

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Setting this flag adds the debugger dependency, but doesn't automatically set
6262
`PYTHONBREAKPOINT` to change `breakpoint()` behavior.
6363
:::
6464

65-
:::{versionadded} VERSION_NEXT_FEATURE
65+
:::{versionadded} 1.9.0
6666
:::
6767
::::
6868

@@ -169,7 +169,7 @@ If you need to match a version that isn't present, then you have two options:
169169
)
170170
```
171171

172-
2. Use {obj}`python.single_override` to re-introduce the desired version so
172+
2. Use {obj}`python.single_version_override` to re-introduce the desired version so
173173
that the corresponding `//python/config_setting:is_python_XXX` target is
174174
generated.
175175
:::

docs/conf.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,33 @@
107107
primary_domain = None # The default is 'py', which we don't make much use of
108108
nitpicky = True
109109

110+
# Ignore nitpicks for missing cross-references to external objects.
111+
# These are typically objects that aren't documented or aren't easily linked
112+
# via intersphinx mapping, so we suppress warnings for them to keep the build clean.
110113
nitpick_ignore_regex = [
111-
# External xrefs aren't setup: ignore missing xref warnings
112-
# External xrefs to sphinx isn't setup: ignore missing xref warnings
113-
("py:.*", "(sphinx|docutils|ast|enum|collections|typing_extensions).*"),
114+
("py:class", r"docutils\..*"),
115+
("py:obj", r"sphinx\.util\.docutils\..*"),
116+
("py:obj", r"sphinx\.util\.docfields\..*"),
117+
("py:class", r"sphinx\.util\.typing\..*"),
118+
("py:class", r"sphinx_bzl\.bzl\..*"),
119+
("py:class", r"typing_extensions\.TypeAlias"),
120+
("bzl:obj", r":current_py_cc_headers_abi3"),
121+
("bzl:obj", r":python"),
122+
("bzl:type", r"T"),
123+
("bzl:type", r"input_value"),
124+
("bzl:type", r"DepsetBuilder"),
125+
("bzl:type", r"RunfilesBuilder"),
126+
("bzl:type", r"BuiltinPyInfo"),
127+
("bzl:type", r".*SentinelInfo"),
128+
("bzl:type", r".*SphinxDocsLibraryInfo"),
129+
("bzl:type", r".*_SphinxRunInfo"),
114130
]
115131

116132
# --- Intersphinx configuration
117133

118134
intersphinx_mapping = {
135+
"python": ("https://docs.python.org/3", None),
136+
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
119137
"bazel": ("https://bazel.build/", "bazel_inventory.inv"),
120138
}
121139

docs/devguide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ to have everything self-documented, we have a special target,
117117
of the requirement-updating scripts in sequence in one go. This can be done once per release as
118118
we prepare for releases.
119119

120+
(creating-backport-prs)=
120121
## Creating Backport PRs
121122

122123
The steps to create a backport PR are:

docs/environment-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The guide on {any}`How to integrate a debugger`
2929
:::{versionadded} 1.3.0
3030
:::
3131
:::{versionchanged} 1.7.0
32-
Support added for {obj}`--bootstrap_impl=system_python`.
32+
Support added for {bzl:flag}`--bootstrap_impl=system_python`.
3333
:::
3434

3535
::::

0 commit comments

Comments
 (0)