Skip to content

Commit c3c2a13

Browse files
committed
Merge branch 'main' into u/dthor/bump-rules_go-gh2956
2 parents 7cc2698 + cdf4f55 commit c3c2a13

File tree

247 files changed

+3350
-984
lines changed

Some content is hidden

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

247 files changed

+3350
-984
lines changed

.bazelci/presubmit.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ tasks:
9090
gazelle_extension_min:
9191
<<: *common_workspace_flags_min_bazel
9292
<<: *minimum_supported_version
93-
name: "Gazelle: workspace, minumum supported Bazel version"
93+
name: "Gazelle: workspace, minimum supported Bazel version"
9494
platform: ubuntu2004
9595
build_targets: ["//..."]
9696
test_targets: ["//..."]
@@ -272,6 +272,15 @@ tasks:
272272
working_directory: examples/bzlmod
273273
platform: debian11
274274
bazel: 7.x
275+
integration_test_bzlmod_ubuntu_vendor:
276+
<<: *reusable_build_test_all
277+
name: "examples/bzlmod: bazel vendor"
278+
working_directory: examples/bzlmod
279+
platform: ubuntu2004
280+
shell_commands:
281+
- "bazel vendor --vendor_dir=./vendor //..."
282+
- "bazel build --vendor_dir=./vendor //..."
283+
- "rm -rf ./vendor"
275284
integration_test_bzlmod_macos:
276285
<<: *reusable_build_test_all
277286
<<: *coverage_targets_example_bzlmod
@@ -338,7 +347,7 @@ tasks:
338347
integration_test_bzlmod_build_file_generation_windows:
339348
<<: *reusable_build_test_all
340349
# coverage is not supported on Windows
341-
name: "examples/bzlmod_build_file_generateion: Windows"
350+
name: "examples/bzlmod_build_file_generation: Windows"
342351
working_directory: examples/bzlmod_build_file_generation
343352
platform: windows
344353

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
55
# To update these lines, execute
66
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
7-
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data
8-
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data
7+
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,rules_python-repro,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data,tests/whl_with_build_files/testdata,tests/whl_with_build_files/testdata/somepkg,tests/whl_with_build_files/testdata/somepkg-1.0.dist-info,tests/whl_with_build_files/testdata/somepkg/subpkg
8+
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,rules_python-repro,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data,tests/whl_with_build_files/testdata,tests/whl_with_build_files/testdata/somepkg,tests/whl_with_build_files/testdata/somepkg-1.0.dist-info,tests/whl_with_build_files/testdata/somepkg/subpkg
99

1010
test --test_output=errors
1111

CHANGELOG.md

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,87 @@ BEGIN_UNRELEASED_TEMPLATE
4747
END_UNRELEASED_TEMPLATE
4848
-->
4949

50+
{#v0-0-0}
51+
## Unreleased
52+
53+
[0.0.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.0.0
54+
55+
{#v0-0-0-changed}
56+
### Changed
57+
* (gazelle) For package mode, resolve dependencies when imports are relative
58+
to the package path. This is enabled via the
59+
`# gazelle:experimental_allow_relative_imports` true directive ({gh-issue}`2203`).
60+
* (gazelle) Types for exposed members of `python.ParserOutput` are now all public.
61+
* (gazelle) Removed the requirement for `__init__.py`, `__main__.py`, or `__test__.py` files to be
62+
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
70+
* (deps[gazelle]) Upgrade versions:
71+
* `rules_go` 0.41.0 -> 0.55.0.
72+
* `gazelle`: WORKSPACE and bzlmod versions now match.
73+
* WORKSPACE: 0.31.0 -> 0.40.0
74+
* bzlmod: 0.33.0 -> 0.40.0
75+
* go: 1.19.4 -> 1.22.0
76+
* Note that this might result in a slight reordering of load statements in
77+
gazelle-generated `BUILD(.bazel)` files to match the ordering set by
78+
buildifier.
79+
80+
{#v0-0-0-fixed}
81+
### Fixed
82+
* (pypi) Fixes an issue where builds using a `bazel vendor` vendor directory
83+
would fail if the constraints file contained environment markers. Fixes
84+
[#2996](https://github.com/bazel-contrib/rules_python/issues/2996).
85+
* (pypi) Wheels with BUILD.bazel (or other special Bazel files) no longer
86+
result in missing files at runtime
87+
([#2782](https://github.com/bazel-contrib/rules_python/issues/2782)).
88+
* (runfiles) The pypi runfiles package now includes `py.typed` to indicate it
89+
supports type checking
90+
([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)).
91+
* (toolchains) `local_runtime_repo` now checks if the include directory exists
92+
before attempting to watch it, fixing issues on macOS with system Python
93+
({gh-issue}`3043`).
94+
* (pypi) The pipstar `defaults` configuration now supports any custom platform
95+
name.
96+
97+
{#v0-0-0-added}
98+
### Added
99+
* (pypi) To configure the environment for `requirements.txt` evaluation, use the newly added
100+
developer preview of the `pip.default` tag class. Only `rules_python` and root modules can use
101+
this feature. You can also configure custom `config_settings` using `pip.default`.
102+
* (pypi) PyPI dependencies now expose an `:extracted_whl_files` filegroup target
103+
of all the files extracted from the wheel. This can be used in lieu of
104+
{obj}`whl_filegroup` to avoid copying/extracting wheel multiple times to
105+
get a subset of their files.
106+
* (gazelle) New directive `gazelle:python_generate_pyi_deps`; when `true`,
107+
dependencies added to satisfy type-only imports (`if TYPE_CHECKING`) and type
108+
stub packages are added to `pyi_deps` instead of `deps`.
109+
* (toolchain) Add toolchains for aarch64 windows for
110+
* 3.11.13
111+
* 3.12.11
112+
* 3.13.5
113+
* 3.14.0b3
114+
115+
{#v0-0-0-removed}
116+
### Removed
117+
* Nothing removed.
118+
119+
{#1-5-1}
120+
## [1.5.1] - 2025-07-06
121+
122+
[1.5.1]: https://github.com/bazel-contrib/rules_python/releases/tag/1.5.1
123+
124+
{#v1-5-1-fixed}
125+
### Fixed
126+
127+
* (pypi) Namespace packages work by default (pkgutil shims are generated
128+
by default again)
129+
([#3038](https://github.com/bazel-contrib/rules_python/issues/3038)).
130+
50131
{#1-5-0}
51132
## [1.5.0] - 2025-06-11
52133

@@ -70,16 +151,8 @@ END_UNRELEASED_TEMPLATE
70151
* (py_wheel) py_wheel always creates zip64-capable wheel zips
71152
* (providers) (experimental) {obj}`PyInfo.venv_symlinks` replaces
72153
`PyInfo.site_packages_symlinks`
73-
* (deps[gazelle]) Upgrade versions:
74-
* `rules_go` 0.41.0 -> 0.55.0.
75-
* `gazelle`: WORKSPACE and bzlmod versions now match.
76-
* WORKSPACE: 0.31.0 -> 0.40.0
77-
* bzlmod: 0.33.0 -> 0.40.0
78-
* go: 1.19.4 -> 1.22.0
79-
* Note that this might result in a slight reordering of load statements in
80-
gazelle-generated `BUILD(.bazel)` files to match the ordering set by
81-
buildifier.
82-
* (deps) Updating setuptools to patch CVE-2025-47273.
154+
* (deps) Updated setuptools to 78.1.1 to patch CVE-2025-47273. This effectively makes
155+
Python 3.9 the minimum supported version for using `pip_parse`.
83156

84157
{#1-5-0-fixed}
85158
### 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`

MODULE.bazel

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,62 @@ register_toolchains("@pythons_hub//:all")
6060
# Install twine for our own runfiles wheel publishing and allow bzlmod users to use it.
6161

6262
pip = use_extension("//python/extensions:pip.bzl", "pip")
63+
64+
# NOTE @aignas 2025-07-06: we define these platforms to keep backwards compatibility with the
65+
# current `experimental_index_url` implementation. Whilst we stabilize the API this list may be
66+
# updated with a mention in the CHANGELOG.
67+
[
68+
pip.default(
69+
arch_name = cpu,
70+
config_settings = [
71+
"@platforms//cpu:{}".format(cpu),
72+
"@platforms//os:linux",
73+
],
74+
env = {"platform_version": "0"},
75+
os_name = "linux",
76+
platform = "linux_{}".format(cpu),
77+
)
78+
for cpu in [
79+
"x86_64",
80+
"aarch64",
81+
# TODO @aignas 2025-05-19: only leave tier 0-1 cpus when stabilizing the
82+
# `pip.default` extension. i.e. drop the below values - users will have to
83+
# define themselves if they need them.
84+
"arm",
85+
"ppc",
86+
"s390x",
87+
]
88+
]
89+
90+
[
91+
pip.default(
92+
arch_name = cpu,
93+
config_settings = [
94+
"@platforms//cpu:{}".format(cpu),
95+
"@platforms//os:osx",
96+
],
97+
# We choose the oldest non-EOL version at the time when we release `rules_python`.
98+
# See https://endoflife.date/macos
99+
env = {"platform_version": "14.0"},
100+
os_name = "osx",
101+
platform = "osx_{}".format(cpu),
102+
)
103+
for cpu in [
104+
"aarch64",
105+
"x86_64",
106+
]
107+
]
108+
109+
pip.default(
110+
arch_name = "x86_64",
111+
config_settings = [
112+
"@platforms//cpu:x86_64",
113+
"@platforms//os:windows",
114+
],
115+
env = {"platform_version": "0"},
116+
os_name = "windows",
117+
platform = "windows_x86_64",
118+
)
63119
pip.parse(
64120
# NOTE @aignas 2024-10-26: We have an integration test that depends on us
65121
# being able to build sdists for this hub, so explicitly set this to False.
@@ -102,7 +158,11 @@ internal_dev_deps = use_extension(
102158
use_repo(
103159
internal_dev_deps,
104160
"buildkite_config",
161+
"implicit_namespace_ns_sub1",
162+
"implicit_namespace_ns_sub2",
105163
"rules_python_runtime_env_tc_info",
164+
"somepkg_with_build_files",
165+
"whl_with_build_files",
106166
)
107167

108168
# Add gazelle plugin so that we can run the gazelle example as an e2e integration

docs/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# rules_python Sphinx docs generation
22

33
The docs for rules_python are generated using a combination of Sphinx, Bazel,
4-
and Readthedocs.org. The Markdown files in source control are unlikely to render
4+
and Read the Docs. The Markdown files in source control are unlikely to render
55
properly without the Sphinx processing step because they rely on Sphinx and
66
MyST-specific Markdown functionality.
77

88
The actual sources that Sphinx consumes are in this directory, with Stardoc
9-
generating additional sources or Sphinx.
9+
generating additional sources for Sphinx.
1010

11-
Manually building the docs isn't necessary -- readthedocs.org will
11+
Manually building the docs isn't necessary -- Read the Docs will
1212
automatically build and deploy them when commits are pushed to the repo.
1313

1414
## Generating docs for development
@@ -31,8 +31,8 @@ equivalent bazel command if desired.
3131
### Installing ibazel
3232

3333
The `ibazel` tool can be used to automatically rebuild the docs as you
34-
development them. See the [ibazel docs](https://github.com/bazelbuild/bazel-watcher) for
35-
how to install it. The quick start for linux is:
34+
develop them. See the [ibazel docs](https://github.com/bazelbuild/bazel-watcher) for
35+
how to install it. The quick start for Linux is:
3636

3737
```
3838
sudo apt install npm
@@ -57,9 +57,9 @@ docs/.
5757
The Sphinx configuration is `docs/conf.py`. See
5858
https://www.sphinx-doc.org/ for details about the configuration file.
5959

60-
## Readthedocs configuration
60+
## Read the Docs configuration
6161

62-
There's two basic parts to the readthedocs configuration:
62+
There's two basic parts to the Read the Docs configuration:
6363

6464
* `.readthedocs.yaml`: This configuration file controls most settings, such as
6565
the OS version used to build, Python version, dependencies, what Bazel
@@ -69,4 +69,4 @@ There's two basic parts to the readthedocs configuration:
6969
controls additional settings such as permissions, what versions are
7070
published, when to publish changes, etc.
7171

72-
For more readthedocs configuration details, see docs.readthedocs.io.
72+
For more Read the Docs configuration details, see docs.readthedocs.io.

0 commit comments

Comments
 (0)