Prepare release v2.3.0 (#4011) Work towards #4010 Co-authored-by: Richard Levasseur <richardlev@gmail.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md index f6dc36e..ede22fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md
@@ -29,6 +29,82 @@ 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=<algo>:<digest>` pins and Simple API + `#<algo>=<digest>` 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 `<algo>:<digest>` 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://<absolute_path>` 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 78f8937..9ae0665 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 @@ 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 bf2a119..0000000 --- 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 71b20ac..0000000 --- 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 dd991e4..0000000 --- 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 64a16fd..0000000 --- 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 0e45d3c..0000000 --- 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 579d1b5..0000000 --- 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 a30f475..0000000 --- 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 83cd047..0000000 --- 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://<absolute_path>` 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 87e0bd9..0000000 --- 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 70558dd..0000000 --- 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 f96f803..0000000 --- a/news/3972.fixed.md +++ /dev/null
@@ -1,11 +0,0 @@ -(pypi) Requirement `--hash=<algo>:<digest>` pins and Simple API -`#<algo>=<digest>` 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 `<algo>:<digest>` 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 20d1361..0000000 --- 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 8418abd..0000000 --- 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 2c5cbb5..0000000 --- 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 d81877a..8e90517 100644 --- a/python/cc/py_extension.bzl +++ b/python/cc/py_extension.bzl
@@ -11,7 +11,7 @@ :::{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 6b697ab..b766851 100644 --- a/python/private/cc/py_extension_macro.bzl +++ b/python/private/cc/py_extension_macro.bzl
@@ -50,7 +50,7 @@ - `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 208a958..a56ae7c 100644 --- a/python/private/py_cc_toolchain_info.bzl +++ b/python/private/py_cc_toolchain_info.bzl
@@ -22,7 +22,7 @@ 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 @@ 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 @@ 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 @@ [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 02d4222..405a8af 100644 --- a/python/private/py_cc_toolchain_rule.bzl +++ b/python/private/py_cc_toolchain_rule.bzl
@@ -143,7 +143,7 @@ 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 @@ doc = """\ Target C library variant, e.g. 'glibc', 'musl'. -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, default = "", @@ -185,7 +185,7 @@ 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 @@ 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 caca92a..ed1fa28 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl
@@ -751,7 +751,7 @@ This is designed to work with dependency management tools like Renovate. ::: -:::{versionadded} VERSION_NEXT_FEATURE +:::{versionadded} 2.3.0 ::: """, ), @@ -934,7 +934,7 @@ 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 @@ 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 640a651..47b0546 100644 --- a/python/private/pypi/whl_library.bzl +++ b/python/private/pypi/whl_library.bzl
@@ -587,7 +587,7 @@ (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 @@ 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 0d7d2ba..8932d00 100644 --- a/python/private/python.bzl +++ b/python/private/python.bzl
@@ -1117,7 +1117,7 @@ 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 ::: """, ),