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
20 changes: 5 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,14 @@ A brief description of the categories of changes:
* Particular sub-systems are identified using parentheses, e.g. `(bzlmod)` or
`(docs)`.

<!--
BEGIN_UNRELEASED_TEMPLATE

{#v0-0-0}
## Unreleased

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

Unreleased changes are tracked as individual files in the [news/](./news) directory.

END_UNRELEASED_TEMPLATE
-->
{#v0-0-0}
{#unreleased}
## Unreleased

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

Unreleased changes are tracked as individual files in the [news/](./news) directory.
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-1-0}
## [2.1.0] - 2026-06-17
Expand Down
24 changes: 23 additions & 1 deletion docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ load("@sphinxdocs//sphinxdocs:readthedocs.bzl", "readthedocs_install")
load("@sphinxdocs//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")
load("@sphinxdocs//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
load("@sphinxdocs//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardoc", "sphinx_stardocs")
load("//python:defs.bzl", "py_binary")
load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility
load("//python/private:common_labels.bzl", "labels") # buildifier: disable=bzl-visibility
load("//python/uv:lock.bzl", "lock") # buildifier: disable=bzl-visibility
Expand All @@ -37,6 +38,27 @@ _TARGET_COMPATIBLE_WITH = select({
"//conditions:default": ["@platforms//:incompatible"],
}) if BZLMOD_ENABLED else ["@platforms//:incompatible"]

py_binary(
name = "merge_changelog",
srcs = ["merge_changelog.py"],
target_compatible_with = _TARGET_COMPATIBLE_WITH,
deps = [
"//tools/private/release:changelog_news",
],
)

genrule(
name = "merged_changelog",
srcs = [
"//:CHANGELOG.md",
"//news:news_files",
],
outs = ["changelog.md"],
cmd = "$(location :merge_changelog) --changelog $(location //:CHANGELOG.md) --news-dir news --output $@",
target_compatible_with = _TARGET_COMPATIBLE_WITH,
tools = [":merge_changelog"],
)

# See README.md for instructions. Short version:
# * `bazel run //docs:docs.serve` in a separate terminal
# * `ibazel build //docs:docs` to automatically rebuild docs
Expand All @@ -60,8 +82,8 @@ sphinx_docs(
"html",
],
renamed_srcs = {
"//:CHANGELOG.md": "changelog.md",
"//:CONTRIBUTING.md": "contributing.md",
":merged_changelog": "changelog.md",
"@sphinxdocs//sphinxdocs/inventories:bazel_inventory": "bazel_inventory.inv",
},
sphinx = ":sphinx-build",
Expand Down
38 changes: 38 additions & 0 deletions docs/merge_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""A tool to merge news entries into CHANGELOG.md for documentation preview."""

import argparse
import pathlib

from tools.private.release import changelog_news


def main():
parser = argparse.ArgumentParser(description="Merge news entries into CHANGELOG.md")
parser.add_argument(
"--changelog", type=pathlib.Path, required=True, help="Path to CHANGELOG.md"
)
parser.add_argument(
"--news-dir", type=pathlib.Path, required=True, help="Path to news directory"
)
parser.add_argument(
"--output",
type=pathlib.Path,
required=True,
help="Path to output merged changelog",
)
args = parser.parse_args()

# Call the public merge_new_into_changelog function
# Using deterministic date "0000-00-00" and version "0.0.0"
changelog_news.merge_new_into_changelog(
changelog_path=args.changelog,
output_path=args.output,
news_dir=args.news_dir,
version="unreleased",
release_date="0000-00-00",
delete_news=False,
)


if __name__ == "__main__":
main()
Loading