Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ BEGIN_UNRELEASED_TEMPLATE
END_UNRELEASED_TEMPLATE
-->

{#v0-0-0}
## Unreleased
{#v1-7-0}
## [1.7.0] - 2025-10-11

[0.0.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.0.0
[1.7.0]: https://github.com/bazel-contrib/rules_python/releases/tag/1.7.0

{#v0-0-0-removed}
{#v1-7-0-removed}
### Removed
* (core rules) Support for Bazel's long deprecated "extra actions" has been
removed
([#3215](https://github.com/bazel-contrib/rules_python/issues/3215)).

{#v0-0-0-changed}
{#v1-7-0-changed}
### Changed
* (deps) bumped rules_cc dependency to `0.1.5`.
* (bootstrap) For {obj}`--bootstrap_impl=system_python`, `PYTHONPATH` is no
Expand Down Expand Up @@ -88,7 +88,7 @@ END_UNRELEASED_TEMPLATE

[20251010]: https://github.com/astral-sh/python-build-standalone/releases/tag/20251010

{#v0-0-0-fixed}
{#v1-7-0-fixed}
### Fixed
* (rules) The `PyInfo` constructor was setting the wrong value for
`has_py3_only_sources` - this is now fixed.
Expand Down Expand Up @@ -117,7 +117,7 @@ END_UNRELEASED_TEMPLATE
* (rules) {obj}`py_console_script_binary` is now compatible with symbolic macros
([#3195](https://github.com/bazel-contrib/rules_python/pull/3195)).

{#v0-0-0-added}
{#v1-7-0-added}
### Added
* (runfiles) The Python runfiles library now supports Bazel's
`--incompatible_compact_repo_mapping_manifest` flag.
Expand Down Expand Up @@ -1980,4 +1980,4 @@ Breaking changes:
* (pip) Create all_data_requirements alias
* Expose Python C headers through the toolchain.

[0.24.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.24.0
[0.24.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.24.0
2 changes: 1 addition & 1 deletion docs/api/rules_python/python/cc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This target provides:

* `CcInfo`: The C++ information about the Python ABI3 headers.

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
The {obj}`features.headers_abi3` attribute can be used to detect if this target
is available or not.
:::
Expand Down
4 changes: 2 additions & 2 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The {bzl:obj}`interpreter_args` attribute.

:::{versionadded} 1.3.0
:::
:::{versionchanged} VERSION_NEXT_FEATURE
:::{versionchanged} 1.7.0
Support added for {obj}`--bootstrap_impl=system_python`.
:::

Expand Down Expand Up @@ -71,7 +71,7 @@ instead of the legacy Python scripts.

:::{versionadded} 1.5.0
:::
:::{versionchanged} VERSION_NEXT_FEATURE
:::{versionchanged} 1.7.0
Flipped to be enabled by default.
:::
::::
Expand Down
2 changes: 1 addition & 1 deletion python/extensions/config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _config_impl(mctx):
config = module_extension(
doc = """Global settings for rules_python.

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
:::
""",
implementation = _config_impl,
Expand Down
2 changes: 1 addition & 1 deletion python/features.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _features_typedef():
True if the {obj}`@rules_python//python/cc:current_py_cc_headers_abi3`
target is available.

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
:::
::::

Expand Down
2 changes: 1 addition & 1 deletion python/private/attributes.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ https://bazel.build/extending/config#memory-performance-considerations for
more information about risks and considerations.
:::

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
:::
""",
),
Expand Down
2 changes: 1 addition & 1 deletion python/private/current_py_cc_headers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ cc_library(
)
```

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
:::
""",
)
2 changes: 1 addition & 1 deletion python/private/py_cc_toolchain_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fields:
e.g. `:current_py_cc_headers` to act as the underlying headers target it
represents).

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
The {obj}`features.headers_abi3` attribute can be used to detect if this
attribute is available or not.
:::
Expand Down
2 changes: 1 addition & 1 deletion python/private/py_cc_toolchain_rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Target that provides the Python ABI3 (stable abi) headers.

Typically this is a cc_library target.

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
The {obj}`features.headers_abi3` attribute can be used to detect if this
attribute is available or not.
:::
Expand Down
2 changes: 1 addition & 1 deletion python/private/py_executable.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ This is mutually exclusive with {obj}`main`.

:::{versionadded} 1.3.0
:::
:::{versionchanged} VERSION_NEXT_FEATURE
:::{versionchanged} 1.7.0
Support added for {obj}`--bootstrap_impl=system_python`.
:::
""",
Expand Down
2 changes: 1 addition & 1 deletion python/private/py_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ the venv to create the path under.
A file that `venv_path` should point to. The file to link to should also be in
`files`.

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
:::
""",
"link_to_path": """
Expand Down
2 changes: 1 addition & 1 deletion python/runfiles/runfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

See @rules_python//python/runfiles/README.md for usage instructions.

:::{versionadded} VERSION_NEXT_FEATURE
:::{versionadded} 1.7.0
Support for Bazel's `--incompatible_compact_repo_mapping_manifest` flag was added.
This enables prefix-based repository mappings to reduce memory usage for large
dependency graphs under bzlmod.
Expand Down
57 changes: 57 additions & 0 deletions tests/tools/private/release/release_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,62 @@ def test_get_latest_version_only_rc_tags(self, mock_get_tags):
releaser.get_latest_version()


class DetermineNextVersionTest(unittest.TestCase):
def setUp(self):
self.tmpdir = pathlib.Path(tempfile.mkdtemp())
self.original_cwd = os.getcwd()
self.addCleanup(shutil.rmtree, self.tmpdir)

os.chdir(self.tmpdir)
# NOTE: On windows, this must be done before files are deleted.
self.addCleanup(os.chdir, self.original_cwd)

self.mock_get_latest_version = patch(
"tools.private.release.release.get_latest_version"
).start()
self.addCleanup(patch.stopall)

def test_no_markers(self):
(self.tmpdir / "mock_file.bzl").write_text("no markers here")
self.mock_get_latest_version.return_value = "1.2.3"

next_version = releaser.determine_next_version()

self.assertEqual(next_version, "1.2.4")

def test_only_patch(self):
(self.tmpdir / "mock_file.bzl").write_text(
":::{versionchanged} VERSION_NEXT_PATCH"
)
self.mock_get_latest_version.return_value = "1.2.3"

next_version = releaser.determine_next_version()

self.assertEqual(next_version, "1.2.4")

def test_only_feature(self):
(self.tmpdir / "mock_file.bzl").write_text(
":::{versionadded} VERSION_NEXT_FEATURE"
)
self.mock_get_latest_version.return_value = "1.2.3"

next_version = releaser.determine_next_version()

self.assertEqual(next_version, "1.3.0")

def test_both_markers(self):
(self.tmpdir / "mock_file_patch.bzl").write_text(
":::{versionchanged} VERSION_NEXT_PATCH"
)
(self.tmpdir / "mock_file_feature.bzl").write_text(
":::{versionadded} VERSION_NEXT_FEATURE"
)
self.mock_get_latest_version.return_value = "1.2.3"

next_version = releaser.determine_next_version()

self.assertEqual(next_version, "1.3.0")


if __name__ == "__main__":
unittest.main()
8 changes: 4 additions & 4 deletions tools/private/release/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ def create_parser():


def main():
# Change to the workspace root so the script can be run using `bazel run`
if "BUILD_WORKSPACE_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKSPACE_DIRECTORY"])

parser = create_parser()
args = parser.parse_args()

Expand All @@ -179,10 +183,6 @@ def main():
version = determine_next_version()
print(f"Determined next version: {version}")

# Change to the workspace root so the script can be run using `bazel run`
if "BUILD_WORKSPACE_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKSPACE_DIRECTORY"])

print("Updating changelog ...")
release_date = datetime.date.today().strftime("%Y-%m-%d")
update_changelog(version, release_date)
Expand Down