From 873f8b936b1b422723a5df9717a7fc0062799714 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Fri, 7 Aug 2026 08:16:38 +0000 Subject: [PATCH] Prepare release 2.3.0 --- CHANGELOG.md | 76 +++++++++++++++++++ .../python/config_settings/index.md | 2 +- news/3514.added.md | 1 - news/3825.added.md | 6 -- news/3858.fixed.md | 3 - news/3906.fixed.md | 3 - news/3919.fixed.md | 3 - news/3932.added.md | 3 - news/3934.fixed.md | 7 -- news/3935.fixed.md | 4 - news/3950.fixed.md | 3 - news/3952.fixed.md | 3 - news/3972.fixed.md | 11 --- news/3973.added.md | 6 -- news/3978.changed.md | 3 - news/3978.fixed.md | 5 -- python/cc/py_extension.bzl | 2 +- python/private/cc/py_extension_macro.bzl | 2 +- python/private/py_cc_toolchain_info.bzl | 8 +- python/private/py_cc_toolchain_rule.bzl | 8 +- python/private/pypi/extension.bzl | 6 +- python/private/pypi/whl_library.bzl | 4 +- python/private/python.bzl | 2 +- 23 files changed, 93 insertions(+), 78 deletions(-) delete mode 100644 news/3514.added.md delete mode 100644 news/3825.added.md delete mode 100644 news/3858.fixed.md delete mode 100644 news/3906.fixed.md delete mode 100644 news/3919.fixed.md delete mode 100644 news/3932.added.md delete mode 100644 news/3934.fixed.md delete mode 100644 news/3935.fixed.md delete mode 100644 news/3950.fixed.md delete mode 100644 news/3952.fixed.md delete mode 100644 news/3972.fixed.md delete mode 100644 news/3973.added.md delete mode 100644 news/3978.changed.md delete mode 100644 news/3978.fixed.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f6dc36ee73..ede22fc6db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,82 @@ Unreleased changes are tracked as individual files in the [news/](./news) directory, or view the [latest generated changelog](https://rules-python.readthedocs.io/en/latest/changelog.html). +{#v2-3-0} +## [2.3.0] - 2026-08-07 + +[2.3.0]: https://github.com/bazel-contrib/rules_python/releases/tag/2.3.0 + +{#v2-3-0-changed} +### Changed +* (gazelle) **BREAKING** rules_python 1.5.0 or higher is now required. The Python + extension selects its standard library list on `is_python_3.14`, which earlier + versions do not define. + +{#v2-3-0-fixed} +### Fixed +* Fixed `py_binary_rule_builder()` / `py_test_rule_builder()` (from `python/api/executables.bzl`) + failing at analysis time with a visibility error when used to construct a custom rule from an + external module. +* (compile_pip_requirements) Add the explicit `data` attribute and forward it + directly to the generated `py_binary`, so files passed via `data` can be + referenced from `extra_args` using `$(location ...)`. +* (coverage) The warning about a missing bundled `coverage.py` wheel is no longer + emitted as we are now falling back to a pure python wheel + ([#3950](https://github.com/bazel-contrib/rules_python/issues/3950)). +* (gazelle) The Python extension now uses the correct standard library module list for + `python_version` 3.13 and 3.14; previously both fell back to the 3.11 list, so modules + added or removed since then (e.g. `compression.zstd`, `telnetlib`) were misclassified. The + fallback list for unrecognized versions is now the newest available one rather than 3.11 + ([#3978](https://github.com/bazel-contrib/rules_python/pull/3978)). +* (pypi) Allow `uv_lock` to be specified in `pip.parse` without requiring + `requirements_lock` (or other os-specific requirement file attributes) to be + set. +* (pypi) Requirement `--hash=:` pins and Simple API + `#=` URL fragments are now parsed for all hash algorithms + instead of silently dropping everything except `sha256`. Non-sha256 pins are + matched against the digests advertised by the index and downloads are verified + using the corresponding Subresource Integrity value, and the pins are kept in + the requirement line when falling back to `pip` + ([#3972](https://github.com/bazel-contrib/rules_python/issues/3972)). + As part of this, `whl_library` repos created by `pip.parse` now always pass + the digest via the `integrity` attribute (SRI format) instead of `sha256`, + and the lock file facts store digests as `:` values (the facts + version was bumped, so cached index information is refreshed once). +* (pypi) `pip.parse(uv_lock = ...)` no longer exposes uv workspace/root members + that resolve to no wheel or sdist (e.g. `source = { virtual = "." }` or editable + installs). Previously these source-less packages were added to the hub's + `all_requirements` / `all_whl_requirements` with an alias to a subpackage that + does not exist, breaking analysis for anything enumerating the full set such as + `modules_mapping(wheels = all_whl_requirements)` + ([#3934](https://github.com/bazel-contrib/rules_python/issues/3934)). +* (pypi) correctly parse the `index_url` for each wheel so that the source registry is forwarded to + the {obj}`whl_library`. This is so that the `purl` for `package_metadata` can be correctly + constructed. +* (pypi) fixed the URL normalization function to correctly handle local paths + enabling wheel sources files to point to an absolute path. Currently it supports + the `file://` for linux and windows like paths. We also support + envsubst for the said paths from now on. + +{#v2-3-0-added} +### Added +* (bzlmod) Added MODULE.bazel flag aliases for Starlark-defined flags: + `build_python_zip`, `incompatible_default_to_explicit_init_py`, + `python_path`, and `experimental_python_import_all_repositories`. +* (cc) Added experimental {obj}`py_extension` macro for creating C/C++ Python + extension modules + ([#3283](https://github.com/bazel-contrib/rules_python/issues/3283)). + (cc) Added `libc`, `platform_machine`, `platform_tag`, `soabi`, and + `sys_platform` attributes and info fields to {obj}`py_cc_toolchain` / + {obj}`PyCcToolchainInfo`. +* (pip,python) Added `pyproject_toml` attribute to {obj}`pip.default`, {obj}`pip.parse` and {obj}`python.defaults` to read the default Python version from the `requires-python` field of `pyproject.toml`. +* (py_test) Added an opt-in safeguard against `py_test` targets that silently + pass without running any tests. Set + {obj}`--@rules_python//python/config_settings:validate_test_main=enabled` to + fail the build when a test's main module only contains inert top-level + statements (definitions, imports, assignments) and never invokes a test + runner ([#3824](https://github.com/bazel-contrib/rules_python/issues/3824)). + + {#v2-2-0} ## [2.2.0] - 2026-06-30 diff --git a/docs/api/rules_python/python/config_settings/index.md b/docs/api/rules_python/python/config_settings/index.md index 78f8937a4d..9ae0665da2 100644 --- a/docs/api/rules_python/python/config_settings/index.md +++ b/docs/api/rules_python/python/config_settings/index.md @@ -276,7 +276,7 @@ Enabling this requires the exec tools toolchain (with an exec interpreter) to be registered, which is the case for the default hermetic toolchains. ::: -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: :::: diff --git a/news/3514.added.md b/news/3514.added.md deleted file mode 100644 index bf2a119380..0000000000 --- a/news/3514.added.md +++ /dev/null @@ -1 +0,0 @@ -(pip,python) Added `pyproject_toml` attribute to {obj}`pip.default`, {obj}`pip.parse` and {obj}`python.defaults` to read the default Python version from the `requires-python` field of `pyproject.toml`. diff --git a/news/3825.added.md b/news/3825.added.md deleted file mode 100644 index 71b20aca91..0000000000 --- a/news/3825.added.md +++ /dev/null @@ -1,6 +0,0 @@ -(py_test) Added an opt-in safeguard against `py_test` targets that silently -pass without running any tests. Set -{obj}`--@rules_python//python/config_settings:validate_test_main=enabled` to -fail the build when a test's main module only contains inert top-level -statements (definitions, imports, assignments) and never invokes a test -runner ([#3824](https://github.com/bazel-contrib/rules_python/issues/3824)). diff --git a/news/3858.fixed.md b/news/3858.fixed.md deleted file mode 100644 index dd991e4654..0000000000 --- a/news/3858.fixed.md +++ /dev/null @@ -1,3 +0,0 @@ -(compile_pip_requirements) Add the explicit `data` attribute and forward it -directly to the generated `py_binary`, so files passed via `data` can be -referenced from `extra_args` using `$(location ...)`. diff --git a/news/3906.fixed.md b/news/3906.fixed.md deleted file mode 100644 index 64a16fd9c8..0000000000 --- a/news/3906.fixed.md +++ /dev/null @@ -1,3 +0,0 @@ -(pypi) correctly parse the `index_url` for each wheel so that the source registry is forwarded to -the {obj}`whl_library`. This is so that the `purl` for `package_metadata` can be correctly -constructed. diff --git a/news/3919.fixed.md b/news/3919.fixed.md deleted file mode 100644 index 0e45d3ce9c..0000000000 --- a/news/3919.fixed.md +++ /dev/null @@ -1,3 +0,0 @@ -Fixed `py_binary_rule_builder()` / `py_test_rule_builder()` (from `python/api/executables.bzl`) -failing at analysis time with a visibility error when used to construct a custom rule from an -external module. diff --git a/news/3932.added.md b/news/3932.added.md deleted file mode 100644 index 579d1b5f59..0000000000 --- a/news/3932.added.md +++ /dev/null @@ -1,3 +0,0 @@ -(bzlmod) Added MODULE.bazel flag aliases for Starlark-defined flags: -`build_python_zip`, `incompatible_default_to_explicit_init_py`, -`python_path`, and `experimental_python_import_all_repositories`. diff --git a/news/3934.fixed.md b/news/3934.fixed.md deleted file mode 100644 index a30f475770..0000000000 --- a/news/3934.fixed.md +++ /dev/null @@ -1,7 +0,0 @@ -(pypi) `pip.parse(uv_lock = ...)` no longer exposes uv workspace/root members -that resolve to no wheel or sdist (e.g. `source = { virtual = "." }` or editable -installs). Previously these source-less packages were added to the hub's -`all_requirements` / `all_whl_requirements` with an alias to a subpackage that -does not exist, breaking analysis for anything enumerating the full set such as -`modules_mapping(wheels = all_whl_requirements)` -([#3934](https://github.com/bazel-contrib/rules_python/issues/3934)). diff --git a/news/3935.fixed.md b/news/3935.fixed.md deleted file mode 100644 index 83cd0473e8..0000000000 --- a/news/3935.fixed.md +++ /dev/null @@ -1,4 +0,0 @@ -(pypi) fixed the URL normalization function to correctly handle local paths -enabling wheel sources files to point to an absolute path. Currently it supports -the `file://` for linux and windows like paths. We also support -envsubst for the said paths from now on. diff --git a/news/3950.fixed.md b/news/3950.fixed.md deleted file mode 100644 index 87e0bd91a6..0000000000 --- a/news/3950.fixed.md +++ /dev/null @@ -1,3 +0,0 @@ -(coverage) The warning about a missing bundled `coverage.py` wheel is no longer -emitted as we are now falling back to a pure python wheel -([#3950](https://github.com/bazel-contrib/rules_python/issues/3950)). diff --git a/news/3952.fixed.md b/news/3952.fixed.md deleted file mode 100644 index 70558dd986..0000000000 --- a/news/3952.fixed.md +++ /dev/null @@ -1,3 +0,0 @@ -(pypi) Allow `uv_lock` to be specified in `pip.parse` without requiring -`requirements_lock` (or other os-specific requirement file attributes) to be -set. diff --git a/news/3972.fixed.md b/news/3972.fixed.md deleted file mode 100644 index f96f803988..0000000000 --- a/news/3972.fixed.md +++ /dev/null @@ -1,11 +0,0 @@ -(pypi) Requirement `--hash=:` pins and Simple API -`#=` URL fragments are now parsed for all hash algorithms -instead of silently dropping everything except `sha256`. Non-sha256 pins are -matched against the digests advertised by the index and downloads are verified -using the corresponding Subresource Integrity value, and the pins are kept in -the requirement line when falling back to `pip` -([#3972](https://github.com/bazel-contrib/rules_python/issues/3972)). -As part of this, `whl_library` repos created by `pip.parse` now always pass -the digest via the `integrity` attribute (SRI format) instead of `sha256`, -and the lock file facts store digests as `:` values (the facts -version was bumped, so cached index information is refreshed once). diff --git a/news/3973.added.md b/news/3973.added.md deleted file mode 100644 index 20d136179a..0000000000 --- a/news/3973.added.md +++ /dev/null @@ -1,6 +0,0 @@ -(cc) Added experimental {obj}`py_extension` macro for creating C/C++ Python -extension modules -([#3283](https://github.com/bazel-contrib/rules_python/issues/3283)). -(cc) Added `libc`, `platform_machine`, `platform_tag`, `soabi`, and -`sys_platform` attributes and info fields to {obj}`py_cc_toolchain` / -{obj}`PyCcToolchainInfo`. diff --git a/news/3978.changed.md b/news/3978.changed.md deleted file mode 100644 index 8418abd0b3..0000000000 --- a/news/3978.changed.md +++ /dev/null @@ -1,3 +0,0 @@ -(gazelle) **BREAKING** rules_python 1.5.0 or higher is now required. The Python -extension selects its standard library list on `is_python_3.14`, which earlier -versions do not define. diff --git a/news/3978.fixed.md b/news/3978.fixed.md deleted file mode 100644 index 2c5cbb5f5d..0000000000 --- a/news/3978.fixed.md +++ /dev/null @@ -1,5 +0,0 @@ -(gazelle) The Python extension now uses the correct standard library module list for -`python_version` 3.13 and 3.14; previously both fell back to the 3.11 list, so modules -added or removed since then (e.g. `compression.zstd`, `telnetlib`) were misclassified. The -fallback list for unrecognized versions is now the newest available one rather than 3.11 -([#3978](https://github.com/bazel-contrib/rules_python/pull/3978)). diff --git a/python/cc/py_extension.bzl b/python/cc/py_extension.bzl index d81877a702..8e90517789 100644 --- a/python/cc/py_extension.bzl +++ b/python/cc/py_extension.bzl @@ -11,7 +11,7 @@ for information on writing C extension modules. :::{include} /_includes/experimental_api.md ::: -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """ diff --git a/python/private/cc/py_extension_macro.bzl b/python/private/cc/py_extension_macro.bzl index 6b697ab503..b76685113a 100644 --- a/python/private/cc/py_extension_macro.bzl +++ b/python/private/cc/py_extension_macro.bzl @@ -50,7 +50,7 @@ def py_extension( - `module_name`: Pass `module_name = "custom_name"` to override the base module filename. - :::{versionadded} VERSION_NEXT_FEATURE + :::{versionadded} 2.3.0 ::: Args: diff --git a/python/private/py_cc_toolchain_info.bzl b/python/private/py_cc_toolchain_info.bzl index 208a9589ba..a56ae7c960 100644 --- a/python/private/py_cc_toolchain_info.bzl +++ b/python/private/py_cc_toolchain_info.bzl @@ -22,7 +22,7 @@ PyCcToolchainInfo = provider( The runtime's ABI flags, i.e. `sys.abiflags` (e.g. 't' for free-threaded builds). -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, "headers": """\ @@ -106,7 +106,7 @@ If available, information about C libraries, struct with fields: The {pep}`PEP 508` `platform_machine` marker value for the target architecture, e.g. 'x86_64', 'aarch64'. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, "platform_tag": """\ @@ -115,7 +115,7 @@ value for the target architecture, e.g. 'x86_64', 'aarch64'. The PEP 3149 / PEP 425 platform tag for extension modules, e.g. 'x86_64-linux-gnu', 'darwin', or 'win_amd64'. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, "python_version": """ @@ -130,7 +130,7 @@ The SOABI tag for extension modules (see [PEP 3149](https://peps.python.org/pep-3149/)), e.g. 'cpython-311-x86_64-linux-gnu' or 'cp311'. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, "sys_platform": """ diff --git a/python/private/py_cc_toolchain_rule.bzl b/python/private/py_cc_toolchain_rule.bzl index 02d4222fc8..405a8afe56 100644 --- a/python/private/py_cc_toolchain_rule.bzl +++ b/python/private/py_cc_toolchain_rule.bzl @@ -143,7 +143,7 @@ If not set, or set to ``, the ABI flags are automatically derived from `--//python/config_settings:py_freethreaded` (e.g., `'t'` when free-threaded is enabled, or `''` otherwise). -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, ), @@ -171,7 +171,7 @@ attribute is available or not. doc = """\ Target C library variant, e.g. 'glibc', 'musl'. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, default = "", @@ -185,7 +185,7 @@ Target C library variant, e.g. 'glibc', 'musl'. doc = """ Target architecture as a PEP 508 `platform_machine` marker, e.g. 'x86_64', 'aarch64', 'x86_32'. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, default = "", @@ -199,7 +199,7 @@ Target architecture as a PEP 508 `platform_machine` marker, e.g. 'x86_64', 'aarc The SOABI tag for extension modules (see PEP 3149), e.g. 'cpython-311-x86_64-linux-gnu' or 'cp311'. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, default = "", diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index caca92a5f7..ed1fa28664 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -751,7 +751,7 @@ The version must be specified as `==X.Y.Z` (exact version with full semver). This is designed to work with dependency management tools like Renovate. ::: -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, ), @@ -934,7 +934,7 @@ for this `pip.parse()` call, unless `python_version` is set explicitly. The version must be specified as `==X.Y.Z` (exact version with full semver). ::: -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, ), @@ -952,7 +952,7 @@ a corresponding `python.toolchain()` configured. The {obj}`pyproject_toml` attribute for getting the version from a project file. ::: -:::{versionchanged} VERSION_NEXT_FEATURE +:::{versionchanged} 2.3.0 No longer mandatory if the {obj}`pyproject_toml` attribute or {obj}`pip.default.pyproject_toml` is specified. ::: diff --git a/python/private/pypi/whl_library.bzl b/python/private/pypi/whl_library.bzl index 640a6518a6..47b05468ef 100644 --- a/python/private/pypi/whl_library.bzl +++ b/python/private/pypi/whl_library.bzl @@ -587,7 +587,7 @@ The expected checksum of the downloaded whl in Subresource Integrity format (e.g. `sha256-...` or `sha512-...`). Only used when `urls` is passed. If `sha256` is also set, it takes precedence over this attribute. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, ), @@ -673,7 +673,7 @@ The `whl_library` is marked as reproducible if using starlark to extract and par wheel contents without building an `sdist` first. ::: -:::{versionchanged} VERSION_NEXT_FEATURE +:::{versionchanged} 2.3.0 The whl-only pure Starlark operations have been refactored into {obj}`whl_archive` and the previously named {obj}`whl_library` repository became renamed to `pip_archive`. ::: diff --git a/python/private/python.bzl b/python/private/python.bzl index 0d7d2baf40..8932d00e1b 100644 --- a/python/private/python.bzl +++ b/python/private/python.bzl @@ -1117,7 +1117,7 @@ Label pointing to pyproject.toml file to read the default Python version from. When specified, reads the `requires-python` field from pyproject.toml. The version must be specified as `==X.Y.Z` (exact version with full semver). -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, ),