Skip to content

Commit 24013ce

Browse files
committed
Merge branch 'main' of https://github.com/bazel-contrib/rules_python into fix.enable.namespace.pkgs
2 parents 795f8da + 2690e3f commit 24013ce

File tree

9 files changed

+277
-122
lines changed

9 files changed

+277
-122
lines changed

CHANGELOG.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ 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:
64+
* 3.9.23
65+
* 3.10.18
66+
* 3.11.13
67+
* 3.12.11
68+
* 3.14.0b3
69+
* (toolchain) Python 3.13 now references 3.13.5
6370

6471
{#v0-0-0-fixed}
6572
### Fixed
@@ -72,6 +79,9 @@ END_UNRELEASED_TEMPLATE
7279
* (runfiles) The pypi runfiles package now includes `py.typed` to indicate it
7380
supports type checking
7481
([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)).
82+
* (toolchains) `local_runtime_repo` now checks if the include directory exists
83+
before attempting to watch it, fixing issues on macOS with system Python
84+
({gh-issue}`3043`).
7585

7686
{#v0-0-0-added}
7787
### Added
@@ -81,13 +91,18 @@ END_UNRELEASED_TEMPLATE
8191
* (gazelle) New directive `gazelle:python_generate_pyi_deps`; when `true`,
8292
dependencies added to satisfy type-only imports (`if TYPE_CHECKING`) and type
8393
stub packages are added to `pyi_deps` instead of `deps`.
94+
* (toolchain) Add toolchains for aarch64 windows for
95+
* 3.11.13
96+
* 3.12.11
97+
* 3.13.5
98+
* 3.14.0b3
8499

85100
{#v0-0-0-removed}
86101
### Removed
87102
* Nothing removed.
88103

89104
{#1-5-1}
90-
## [1.5.1] - 2025-06-XX
105+
## [1.5.1] - 2025-07-06
91106

92107
[1.5.1]: https://github.com/bazel-contrib/rules_python/releases/tag/1.5.1
93108

@@ -121,7 +136,8 @@ END_UNRELEASED_TEMPLATE
121136
* (py_wheel) py_wheel always creates zip64-capable wheel zips
122137
* (providers) (experimental) {obj}`PyInfo.venv_symlinks` replaces
123138
`PyInfo.site_packages_symlinks`
124-
* (deps) Updating setuptools to patch CVE-2025-47273.
139+
* (deps) Updated setuptools to 78.1.1 to patch CVE-2025-47273. This effectively makes
140+
Python 3.9 the minimum supported version for using `pip_parse`.
125141

126142
{#1-5-0-fixed}
127143
### Fixed

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,25 @@ Not breaking changes:
318318
* Changing internal details, such as renaming an internal file.
319319
* Changing a rule to a macro.
320320

321+
## AI-assisted Contributions
322+
323+
Contributions assisted by AI tools are allowed. However, the human author
324+
submitting the pull request is responsible for the contributed code as if they
325+
had written it entirely themselves. This means:
326+
327+
* **Understanding the code:** You must be able to explain what the code does
328+
and why it's implemented that way. This includes discussing its
329+
implications, and any trade-offs made during its development, just as if you
330+
had written it entirely yourself.
331+
* **Vetting the correctness and functionality:** You are responsible for
332+
thoroughly testing and verifying that the code is correct, functional, and
333+
meets all project requirements and standards.
334+
335+
If the human PR author cannot fulfill these responsibilities, the `rules_python`
336+
maintainers will not spend time reviewing or merging the PR. The goal is to
337+
ensure that all contributions, regardless of their origin, maintain the quality
338+
and integrity of the project and do not place an undue burden on maintainers.
339+
321340
## FAQ
322341

323342
### Installation errors when during `git commit`

docs/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ typing-extensions==4.13.2 \
356356
# via
357357
# rules-python-docs (docs/pyproject.toml)
358358
# sphinx-autodoc2
359-
urllib3==2.4.0 \
360-
--hash=sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466 \
361-
--hash=sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813
359+
urllib3==2.5.0 \
360+
--hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \
361+
--hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc
362362
# via requests

python/private/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1616
load("@bazel_skylib//rules:common_settings.bzl", "bool_setting")
1717
load("//python:py_binary.bzl", "py_binary")
1818
load("//python:py_library.bzl", "py_library")
19-
load("//python:versions.bzl", "print_toolchains_checksums")
19+
load(":print_toolchain_checksums.bzl", "print_toolchains_checksums")
2020
load(":py_exec_tools_toolchain.bzl", "current_interpreter_executable")
2121
load(":sentinel.bzl", "sentinel")
2222
load(":stamp.bzl", "stamp_build_setting")

python/private/local_runtime_repo.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,15 @@ def _local_runtime_repo_impl(rctx):
9999
interpreter_path = info["base_executable"]
100100

101101
# NOTE: Keep in sync with recursive glob in define_local_runtime_toolchain_impl
102-
repo_utils.watch_tree(rctx, rctx.path(info["include"]))
102+
include_path = rctx.path(info["include"])
103+
104+
# The reported include path may not exist, and watching a non-existant
105+
# path is an error. Silently skip, since includes are only necessary
106+
# if C extensions are built.
107+
if include_path.exists and include_path.is_dir:
108+
repo_utils.watch_tree(rctx, include_path)
109+
else:
110+
pass
103111

104112
# The cc_library.includes values have to be non-absolute paths, otherwise
105113
# the toolchain will give an error. Work around this error by making them
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""Print the toolchain versions.
2+
"""
3+
4+
load("//python:versions.bzl", "TOOL_VERSIONS", "get_release_info")
5+
load("//python/private:text_util.bzl", "render")
6+
load("//python/private:version.bzl", "version")
7+
8+
def print_toolchains_checksums(name):
9+
"""A macro to print checksums for a particular Python interpreter version.
10+
11+
Args:
12+
name: {type}`str`: the name of the runnable target.
13+
"""
14+
by_version = {}
15+
16+
for python_version, metadata in TOOL_VERSIONS.items():
17+
by_version[python_version] = _commands_for_version(
18+
python_version = python_version,
19+
metadata = metadata,
20+
)
21+
22+
all_commands = sorted(
23+
by_version.items(),
24+
key = lambda x: version.key(version.parse(x[0], strict = True)),
25+
)
26+
all_commands = [x[1] for x in all_commands]
27+
28+
template = """\
29+
cat > "$@" <<'EOF'
30+
#!/bin/bash
31+
32+
set -o errexit -o nounset -o pipefail
33+
34+
echo "Fetching hashes..."
35+
36+
{commands}
37+
EOF
38+
"""
39+
40+
native.genrule(
41+
name = name,
42+
srcs = [],
43+
outs = ["print_toolchains_checksums.sh"],
44+
cmd = select({
45+
"//python/config_settings:is_python_{}".format(version_str): template.format(
46+
commands = commands,
47+
)
48+
for version_str, commands in by_version.items()
49+
} | {
50+
"//conditions:default": template.format(commands = "\n".join(all_commands)),
51+
}),
52+
executable = True,
53+
)
54+
55+
def _commands_for_version(*, python_version, metadata):
56+
lines = []
57+
lines += [
58+
"cat <<EOB", # end of block
59+
" \"{python_version}\": {{".format(python_version = python_version),
60+
" \"url\": \"{url}\",".format(url = metadata["url"]),
61+
" \"sha256\": {",
62+
]
63+
64+
for platform in metadata["sha256"].keys():
65+
for release_url in get_release_info(platform, python_version)[1]:
66+
# Do lines one by one so that the progress is seen better and use cat for ease of quotation
67+
lines += [
68+
"EOB",
69+
"cat <<EOB",
70+
" \"{platform}\": \"$$({get_sha256})\",".format(
71+
platform = platform,
72+
get_sha256 = "curl --silent --show-error --location --fail {release_url_sha256}".format(
73+
release_url = release_url,
74+
release_url_sha256 = release_url + ".sha256",
75+
),
76+
),
77+
]
78+
79+
prefix = metadata["strip_prefix"]
80+
prefix = render.indent(
81+
render.dict(prefix) if type(prefix) == type({}) else repr(prefix),
82+
indent = " " * 8,
83+
).lstrip()
84+
85+
lines += [
86+
" },",
87+
" \"strip_prefix\": {strip_prefix},".format(strip_prefix = prefix),
88+
" },",
89+
"EOB",
90+
]
91+
92+
return "\n".join(lines)

0 commit comments

Comments
 (0)