Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Prepare new release: `v0.21.0` (#4919)

Benjamin Hackl861cd4849b17
diff --git a/CITATION.cff b/CITATION.cff
index 3457722cf..3b025d049 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -4,10 +4,10 @@ authors:
-
name: "The Manim Community Developers"
cff-version: "1.2.0"
-date-released: 2026-02-27
+date-released: 2026-08-10
license: MIT
message: "We acknowledge the importance of good software to support research, and we note that research becomes more valuable when it is communicated effectively. To demonstrate the value of Manim, we ask that you cite Manim in your work."
title: Manim – Mathematical Animation Framework
url: "https://www.manim.community/"
-version: "v0.20.1"
+version: "v0.21.0"
...
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst
index d2529b141..9d0938a26 100644
--- a/docs/source/changelog.rst
+++ b/docs/source/changelog.rst
@@ -7,6 +7,7 @@ This page contains a list of changes made between releases.
.. toctree::
:maxdepth: 1
+ changelog/0.21.0-changelog
changelog/0.20.1-changelog
changelog/0.20.0-changelog
changelog/0.19.2-changelog
diff --git a/docs/source/changelog/0.21.0-changelog.md b/docs/source/changelog/0.21.0-changelog.md
new file mode 100644
index 000000000..9aee993e8
--- /dev/null
+++ b/docs/source/changelog/0.21.0-changelog.md
@@ -0,0 +1,161 @@
+---
+short-title: v0.21.0
+description: Changelog for v0.21.0
+---
+
+# v0.21.0
+
+Date
+: August 10, 2026
+
+
+## What's Changed
+### Breaking Changes 🚨
+* Delegate color handling in {class}`.Code` to Pygments and document custom styles by {user}`Helbronner` in {pr}`4816`
+
+ {class}`.Code` no longer honors foreground color overrides passed through
+ `paragraph_config={"color": ...}` or `Code.default_paragraph_config["color"]`;
+ syntax and line-number colors now come from the selected Pygments
+ `formatter_style`. To customize them, pass a custom Pygments `Style` subclass
+ through `formatter_style` and configure its token styles and
+ `line_number_color`. Background colors can still be overridden with
+ `background_config={"fill_color": ...}`; otherwise, the selected Pygments
+ style provides the background. See the note in the documentation of {class}`.Code`
+ for an explicit example.
+* Speed up Cairo renderer by 2.2x on animation-heavy scenes by {user}`HamdiBarkous` in {pr}`4695`
+
+ Cairo path construction now uses vectorized subpath splitting, and pixel-array
+ handling avoids redundant copies while producing pixel-identical output. This
+ changes `Camera.convert_pixel_array()`: the `convert_from_floats` argument has
+ been removed, and the method now always converts floats to the camera's pixel
+ format. Omit the argument if it was previously `True`; use
+ `np.array(pixel_array)` instead if relying on the old default copying behavior.
+
+### Highlights 🌟
+* Introduce first-class support for rendering text and markup via Typst (optional dependency) by {user}`behackl` in {pr}`4681`
+
+ The new {class}`.Typst` and {class}`.TypstMath` mobjects compile Typst markup
+ and mathematical expressions directly to SVG without requiring a TeX
+ installation. They support label-based subgroup selection, `{{ ... }}`
+ expression grouping, and integration with existing label APIs. Install the
+ optional dependency with `pip install "manim[typst]"`.
+* Hash NumPy arrays without JSON expansion by {user}`dexhunter` in {pr}`4883`
+
+ NumPy arrays in scene cache keys are now represented by deterministic hashes
+ of their complete logical contents instead of sampled JSON data. This
+ prevents stale cache hits when visible image data changes and reduces hashing
+ CPU time by roughly 94–98% in representative benchmarks.
+* Add support for encoding partial movie files in parallel by {user}`pjfo` in {pr}`4899`
+
+ The new `max_inflight_encoders` configuration option allows partial movie
+ encoding to overlap with rendering while bounding the number of encoder
+ workers. Try it with
+ `manim render --max-inflight-encoders 4 --encoder-queue-size 8 scene.py Scene`;
+ `--encoder-queue-size` limits the pending frame buffers held by each encoder.
+ The default of one in-flight encoder preserves serial behavior; higher values
+ reduced an encoding-heavy benchmark by 56% and larger real-world renders by
+ roughly 8–11%.
+
+### New Features ✨
+* Allow inner lines to be omitted from {class}`.Table` by {user}`leqo-c` in {pr}`4731`
+* Support multiple compiler passes in {class}`.TexTemplate` by {user}`Sazzzzzz` in {pr}`4810`
+* Add a `dot_buff` parameter to {class}`.BulletedList` by {user}`GniLudio` in {pr}`4892`
+
+### Enhancements πŸš€
+* Support tuple-based edge lookup in `GenericGraph.__getitem__()` by {user}`HairlessVillager` in {pr}`3799`
+* Raise a clear error when rendered glyphs do not match input characters by {user}`SupernovaIa` in {pr}`4868`
+* Avoid copying `Mobject.submobjects` in sequence methods by {user}`nikolajmunk` in {pr}`4915`
+* Make additional mobject methods chainable by {user}`GniLudio` in {pr}`4913`
+
+### Bug Fixes πŸ›
+* Fix OpenGL crashes in `arrange_in_grid()` and `get_location()` by {user}`Croustit` in {pr}`4622`
+* Prevent `get_nth_subpath()` from raising `IndexError` and ensure it returns a NumPy array by {user}`MqCreaple` in {pr}`4630`
+* Preserve closed curves in `put_start_and_end_on()` by {user}`GoThrones` in {pr}`4658`
+* Fix inconsistent stroke-width scaling for text in compound objects by {user}`vihdutta` in {pr}`4694`
+* Accept a single `Group` or `VGroup` in `CyclicReplace` and `Swap` by {user}`irvanalhaq9` in {pr}`4211`
+* Prevent empty submobjects from distorting parent dimensions by {user}`gvauvert` in {pr}`4088`
+* Honor `language` when constructing `Code` from `code_file` by {user}`GniLudio` in {pr}`4706`
+* Fix `ThreeDScene.set_to_default_angled_camera_orientation()` raising `AttributeError` by {user}`siddhu-pikachu` in {pr}`4704`
+* Fix reversed default resolution in `manim init project --default` by {user}`aoxiangtianyu-go` in {pr}`4839`
+* Prevent memoizer collisions between object hashes and IDs by {user}`pjfo` in {pr}`4901`
+* Prevent `round_corners()` failures for collinear vertices by {user}`MeiSiristhebest` in {pr}`4906`
+* Fix `checkhealth` false positives for uv launcher shims by {user}`srinu2003` in {pr}`4889`
+* Fix OpenGL triangulation errors at ring boundaries by {user}`Theelx` in {pr}`4819`
+* Fix {class}`.Angle` crashes for parallel or collinear lines by {user}`MeiSiristhebest` in {pr}`4907`
+* Stabilize cache hashes for transient objects by {user}`pjfo` in {pr}`4896`
+* Ignore SVG shape elements without points by {user}`behackl` in {pr}`4917`
+* Normalize {class}`.Code` baseline alignment in {class}`.Paragraph` by {user}`Croustit` in {pr}`4692`
+* Preserve z-index ordering in animation groups by {user}`behackl` in {pr}`4918`
+* Let {class}`.MathTex` handle multiline strings by {user}`henrikmidtiby` in {pr}`4634`
+* Ensure that glyphs at end of {class}`.Code` lines are no longer deleted when `disable_ligatures` is `False` by {user}`nikolajmunk` in {pr}`4926`
+
+### Documentation πŸ“š
+* Correct `SquareToCircle` terminology in the quickstart guide by {user}`xuruidong` in {pr}`4631`
+* Correct angle ranges in {class}`.Sphere` documentation and add examples by {user}`Jackyuanx` in {pr}`3973`
+* Document edge lookup in `GenericGraph.__getitem__()` by {user}`mayank-dev-15` in {pr}`4761`
+* Correct the {class}`.FadeOut` example name by {user}`GniLudio` in {pr}`4832`
+* Document whitespace-stripped indexing in {class}`.Text` by {user}`SupernovaIa` in {pr}`4866`
+* Preserve line color in the `MovingDots` example by {user}`shenao010415` in {pr}`4895`
+* Correct the font-directory lookup documented for `register_font()` by {user}`ExploreMaths` in {pr}`4880`
+* Correct angle ordering in the `cartesian_to_spherical()` and `spherical_to_cartesian()` docstrings by {user}`changsheng0804-blip` in {pr}`4764`
+* Clarify frame terminology in the {class}`.MovingCameraScene` example by {user}`nikolajmunk` in {pr}`4910`
+
+### Testing πŸ§ͺ
+* Add unit tests for color helper functions by {user}`THE-RAF` in {pr}`4749`
+* Add regression tests for four recent `VMobject` fixes by {user}`THE-RAF` in {pr}`4750`
+* Add tests for edge lookup in `GenericGraph.__getitem__()` by {user}`sridhar-3009` in {pr}`4753`
+* Add a regression test for text stroke-width scaling in compound objects by {user}`vihdutta` in {pr}`4703`
+
+### Infrastructure & Build πŸ”¨
+* Update TinyTeX installation on Windows and macOS to fix CI failures by {user}`chopan050` in {pr}`4679`
+* Update CI workflow dependencies by {user}`behackl` in {pr}`4677`
+* Switch package builds from Hatchling to uv-build by {user}`JasonGrace2282` in {pr}`4619`
+
+### Code Quality & Refactoring 🧹
+* Update the project metadata link to X (formerly Twitter) by {user}`henrikmidtiby` in {pr}`4642`
+* Replace a bare `except` in `rate_functions.py` by {user}`koteshyelamati` in {pr}`4891`
+* Simplify the {class}`.Code` syntax-coloring implementation by {user}`GniLudio` in {pr}`4894`
+* Update pre-commit hooks by {user}`behackl` in {pr}`4920`
+* Rename `TypstMath` to {class}`.MathTypst` to match existing {class}`.Tex` / {class}`.MathTex` coupling by {user}`behackl` in {pr}`4925`
+
+### Type Hints πŸ“
+* Add type annotations to `mobject.py` by {user}`henrikmidtiby` in {pr}`4388`
+* Use `npt.NDArray[np.float64]` for `VMobject._bezier_t_values` by {user}`GoThrones` in {pr}`4675`
+* Improve `Callable` annotations for mobject updater utilities by {user}`treszkai` in {pr}`4728`
+* Add type annotations to `transform_matching_parts.py` by {user}`henrikmidtiby` in {pr}`4400`
+* Fix the `_on_finish` annotation in `Animation.__init__` by {user}`GniLudio` in {pr}`4812`
+* Add type annotations to `table.py` by {user}`henrikmidtiby` in {pr}`4641`
+
+### Other Changes
+* Prepare new release: `v0.21.0` by {user}`behackl` in {pr}`4919`
+
+## New Contributors
+* {user}`Croustit` made their first contribution in {pr}`4622`
+* {user}`xuruidong` made their first contribution in {pr}`4631`
+* {user}`MqCreaple` made their first contribution in {pr}`4630`
+* {user}`vihdutta` made their first contribution in {pr}`4694`
+* {user}`THE-RAF` made their first contribution in {pr}`4749`
+* {user}`leqo-c` made their first contribution in {pr}`4731`
+* {user}`treszkai` made their first contribution in {pr}`4728`
+* {user}`gvauvert` made their first contribution in {pr}`4088`
+* {user}`sridhar-3009` made their first contribution in {pr}`4753`
+* {user}`GniLudio` made their first contribution in {pr}`4706`
+* {user}`mayank-dev-15` made their first contribution in {pr}`4761`
+* {user}`siddhu-pikachu` made their first contribution in {pr}`4704`
+* {user}`Sazzzzzz` made their first contribution in {pr}`4810`
+* {user}`aoxiangtianyu-go` made their first contribution in {pr}`4839`
+* {user}`SupernovaIa` made their first contribution in {pr}`4866`
+* {user}`koteshyelamati` made their first contribution in {pr}`4891`
+* {user}`pjfo` made their first contribution in {pr}`4901`
+* {user}`MeiSiristhebest` made their first contribution in {pr}`4906`
+* {user}`shenao010415` made their first contribution in {pr}`4895`
+* {user}`ExploreMaths` made their first contribution in {pr}`4880`
+* {user}`srinu2003` made their first contribution in {pr}`4889`
+* {user}`changsheng0804-blip` made their first contribution in {pr}`4764`
+* {user}`Theelx` made their first contribution in {pr}`4819`
+* {user}`dexhunter` made their first contribution in {pr}`4883`
+* {user}`nikolajmunk` made their first contribution in {pr}`4910`
+* {user}`Helbronner` made their first contribution in {pr}`4816`
+* {user}`HamdiBarkous` made their first contribution in {pr}`4695`
+
+**Full Changelog**: [Compare view](https://github.com/ManimCommunity/manim/compare/v0.20.1...v0.21.0)
diff --git a/pyproject.toml b/pyproject.toml
index cc17cfe23..825d92c80 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "manim"
-version = "0.20.1"
+version = "0.21.0"
description = "Animation engine for explanatory math videos."
authors = [
{name = "The Manim Community Developers", email = "[email protected]"},
diff --git a/scripts/release.py b/scripts/release.py
index 29915b3e3..b611a99aa 100644
--- a/scripts/release.py
+++ b/scripts/release.py
@@ -4,6 +4,7 @@ Release management tools for Manim.
This script provides commands for preparing and managing Manim releases:
- Generate changelogs from GitHub's release notes API
+- Export documentation changelogs as GitHub-flavored release notes
- Update CITATION.cff with new version information
- Fetch existing release notes for documentation
@@ -11,9 +12,15 @@ Usage:
# Generate changelog for an upcoming release
uv run python scripts/release.py changelog --base v0.19.0 --version 0.20.0
+ # Include a PR omitted by GitHub's generated release notes
+ uv run python scripts/release.py changelog --base v0.19.0 --version 0.20.0 --include-extra 1234
+
# Also update CITATION.cff at the same time
uv run python scripts/release.py changelog --base v0.19.0 --version 0.20.0 --update-citation
+ # Export an edited changelog for pasting into a GitHub release
+ uv run python scripts/release.py export-changelog 0.20.0
+
# Update only CITATION.cff
uv run python scripts/release.py citation --version 0.20.0
@@ -27,6 +34,7 @@ Requirements:
from __future__ import annotations
+import json
import re
import subprocess
import sys
@@ -102,8 +110,6 @@ def get_release_tags() -> list[str]:
if result.returncode != 0 or not result.stdout.strip():
return []
- import json
-
try:
data = json.loads(result.stdout)
return [item["tagName"] for item in data]
@@ -150,6 +156,29 @@ def get_release_date(tag: str) -> str | None:
return None
+def get_pull_request_release_note(number: int) -> str:
+ """Return a GitHub-style release-note bullet for a pull request."""
+ result = run_gh(
+ [
+ "pr",
+ "view",
+ str(number),
+ "--repo",
+ REPO,
+ "--json",
+ "title,author,url",
+ ]
+ )
+ try:
+ data = json.loads(result.stdout)
+ title = data["title"]
+ author = data["author"]["login"]
+ url = data["url"]
+ except (json.JSONDecodeError, KeyError, TypeError) as error:
+ raise click.ClickException(f"Could not read pull request #{number}") from error
+ return f"* {title} by @{author} in {url}"
+
+
def generate_release_notes(head_tag: str, base_tag: str) -> str:
"""
Generate release notes using GitHub's API.
@@ -215,6 +244,148 @@ def version_gte(version: str, min_version: str) -> bool:
# =============================================================================
+_PR_REFERENCE = re.compile(
+ r"(?:\{pr\}`(?P<myst>\d+)`|"
+ r"https://github\.com/ManimCommunity/manim/pull/(?P<url>\d+))"
+)
+_TOP_LEVEL_BULLET = re.compile(r"^[*-]\s")
+_SECOND_LEVEL_HEADING = re.compile(r"^##(?!#)\s+(.+?)\s*$")
+_ANY_HEADING = re.compile(r"^#{1,6}\s")
+_CHANGELOG_SECTION_SCOPES = {
+ "What's Changed": "changes",
+ "New Contributors": "contributors",
+}
+
+
+def include_extra_pull_requests(body: str, numbers: Sequence[int]) -> str:
+ """Add explicitly requested PRs to the generated "Other Changes" category."""
+ existing_numbers = {
+ int(match.group("url"))
+ for match in _PR_REFERENCE.finditer(body)
+ if match.group("url") is not None
+ }
+ entries = [
+ get_pull_request_release_note(number)
+ for number in numbers
+ if number not in existing_numbers
+ ]
+ if not entries:
+ return body
+
+ lines = body.splitlines()
+ category_heading = "### Other Changes"
+ try:
+ category_start = lines.index(category_heading)
+ except ValueError:
+ insertion_point = next(
+ (
+ index
+ for index, line in enumerate(lines)
+ if line == "## New Contributors"
+ or line.startswith("**Full Changelog**:")
+ ),
+ len(lines),
+ )
+ lines[insertion_point:insertion_point] = [category_heading, *entries]
+ else:
+ insertion_point = category_start + 1
+ while insertion_point < len(lines) and not lines[insertion_point].startswith(
+ "#"
+ ):
+ insertion_point += 1
+ while (
+ insertion_point > category_start + 1
+ and not lines[insertion_point - 1].strip()
+ ):
+ insertion_point -= 1
+ lines[insertion_point:insertion_point] = entries
+
+ return "\n".join(lines)
+
+
+def _find_pull_request_blocks(
+ lines: list[str],
+) -> list[tuple[int, int, tuple[str, str]]]:
+ """Find PR list items and their continuation lines in a changelog.
+
+ The returned key includes the enclosing second-level section so that a PR's
+ release note and its potential "New Contributors" entry are kept separate.
+ Third-level category headings are deliberately not part of the key: the
+ newly generated changelog remains authoritative for PR categorization.
+ """
+ blocks = []
+ section_scope: str | None = None
+ line_number = 0
+
+ while line_number < len(lines):
+ line = lines[line_number]
+ heading = _SECOND_LEVEL_HEADING.match(line.rstrip("\r\n"))
+ if heading:
+ section_scope = _CHANGELOG_SECTION_SCOPES.get(heading.group(1))
+ line_number += 1
+ continue
+
+ if section_scope is None or not _TOP_LEVEL_BULLET.match(line):
+ line_number += 1
+ continue
+
+ pr_reference = _PR_REFERENCE.search(line)
+ if pr_reference is None:
+ line_number += 1
+ continue
+
+ pr_number = pr_reference.group("myst") or pr_reference.group("url")
+ block_end = line_number + 1
+ while block_end < len(lines):
+ next_line = lines[block_end]
+ if (
+ _TOP_LEVEL_BULLET.match(next_line)
+ or _ANY_HEADING.match(next_line)
+ or next_line.startswith("**Full Changelog**:")
+ ):
+ break
+ block_end += 1
+ while block_end > line_number + 1 and not lines[block_end - 1].strip():
+ block_end -= 1
+
+ blocks.append(
+ (line_number, block_end, (section_scope, pr_number)),
+ )
+ line_number = block_end
+
+ return blocks
+
+
+def merge_changelog(generated: str, existing: str) -> str:
+ """Merge existing PR note edits into a newly generated changelog.
+
+ The generated changelog controls which PRs are present, their ordering, and
+ their category headings. For every PR that is present in both versions, its
+ existing list item (including indented descriptions) is retained. Thus,
+ deleted entries are restored and label changes move entries to their newly
+ generated categories without discarding copy edits.
+ """
+ generated_lines = generated.splitlines(keepends=True)
+ existing_lines = existing.splitlines(keepends=True)
+ existing_blocks = {
+ key: "".join(existing_lines[start:end])
+ for start, end, key in _find_pull_request_blocks(existing_lines)
+ }
+
+ merged = []
+ previous_end = 0
+ for start, end, key in _find_pull_request_blocks(generated_lines):
+ merged.extend(generated_lines[previous_end:start])
+ existing_block = existing_blocks.get(key)
+ if existing_block is None:
+ merged.extend(generated_lines[start:end])
+ else:
+ merged.append(existing_block)
+ previous_end = end
+ merged.extend(generated_lines[previous_end:])
+ return "".join(merged)
+
+
def convert_to_myst(body: str) -> str:
"""
Convert GitHub markdown to MyST format.
@@ -286,6 +457,46 @@ description: Changelog for {title}
"""
+def convert_to_github(body: str) -> str:
+ """Convert the MyST roles used by changelogs to GitHub Markdown."""
+ body = re.sub(
+ r"\{pr\}`(\d+)`",
+ rf"https://github.com/{REPO}/pull/\1",
+ body,
+ )
+ body = re.sub(
+ r"\{issue\}`(\d+)`",
+ rf"https://github.com/{REPO}/issues/\1",
+ body,
+ )
+ body = re.sub(r"\{user\}`([a-zA-Z0-9_-]+)`", r"@\1", body)
+ body = re.sub(r"\{class\}`\.?(.*?)`", r"`\1`", body)
+ return body
+
+
+def format_github_release_notes(version: str, content: str) -> str:
+ """Create a GitHub release body from a documentation changelog."""
+ content = re.sub(r"\A---\r?\n.*?\r?\n---\r?\n", "", content, flags=re.DOTALL)
+ lines = content.splitlines()
+
+ while lines and not lines[0].strip():
+ lines.pop(0)
+ if lines and lines[0].startswith("# "):
+ lines.pop(0)
+ while lines and not lines[0].strip():
+ lines.pop(0)
+ if len(lines) >= 2 and lines[0] == "Date" and lines[1].startswith(": "):
+ del lines[:2]
+ while lines and not lines[0].strip():
+ lines.pop(0)
+
+ body = convert_to_github("\n".join(lines)).rstrip()
+ changelog_url = (
+ f"https://docs.manim.community/en/stable/changelog/{version}-changelog.html"
+ )
+ return f"See [our rendered changelog]({changelog_url}).\n\n{body}\n"
+
+
# =============================================================================
# File Operations
# =============================================================================
@@ -346,6 +557,13 @@ def cli(ctx: click.Context, dry_run: bool) -> None:
)
@click.option("--head", default="main", help="Head ref for comparison (default: main)")
@click.option("--title", help="Custom changelog title (default: vX.Y.Z)")
+ "--include-extra",
+ "extra_prs",
+ type=click.IntRange(min=1),
+ multiple=True,
+ help="Include a PR omitted by GitHub's generated notes; may be repeated",
+)
@click.option(
"--update-citation",
"also_update_citation",
@@ -359,6 +577,7 @@ def changelog(
version: str,
head: str,
title: str | None,
+ extra_prs: tuple[int, ...],
also_update_citation: bool,
) -> None:
"""Generate changelog for an upcoming release.
@@ -373,13 +592,21 @@ def changelog(
click.echo(f" Comparing: {base_tag} β†’ {head}")
body = generate_release_notes(head_tag, base_tag)
+ if extra_prs:
+ click.echo(f" Including extra PRs: {', '.join(f'#{pr}' for pr in extra_prs)}")
+ body = include_extra_pull_requests(body, extra_prs)
date = datetime.now().strftime("%B %d, %Y")
content = format_changelog(version, body, date=date, title=title)
+ filepath = CHANGELOG_DIR / f"{version}-changelog.md"
+
+ if filepath.exists():
+ click.echo(" Preserving existing PR note edits...")
+ content = merge_changelog(content, filepath.read_text())
if dry_run:
click.echo()
click.secho("[DRY RUN]", fg="yellow", bold=True)
- click.echo(f" Would save: {CHANGELOG_DIR / f'{version}-changelog.md'}")
+ click.echo(f" Would save: {filepath}")
if also_update_citation:
click.echo(f" Would update: {CITATION_FILE}")
click.echo()
@@ -400,6 +627,24 @@ def changelog(
click.echo(" β€’ Update docs/source/changelog.rst to include the new file")
[email protected]("export-changelog")
+def export_changelog(version: str) -> None:
+ """Export VERSION's changelog as GitHub-flavored release notes.
+
+ The output is written to stdout for pasting or piping to another command.
+ """
+ version = version_from_tag(version)
+ filepath = CHANGELOG_DIR / f"{version}-changelog.md"
+ if not filepath.exists():
+ raise click.ClickException(f"Changelog not found: {filepath}")
+
+ click.echo(
+ format_github_release_notes(version, filepath.read_text()),
+ nl=False,
+ )
+
+
@cli.command()
@click.option(
"--version", "version", required=True, help="Version number (e.g., 0.20.0)"
diff --git a/tests/test_release_script.py b/tests/test_release_script.py
new file mode 100644
index 000000000..8b5e544a9
--- /dev/null
+++ b/tests/test_release_script.py
@@ -0,0 +1,156 @@
+from scripts import release
+from scripts.release import (
+ format_github_release_notes,
+ include_extra_pull_requests,
+ merge_changelog,
+)
+
+
+def test_merge_changelog_preserves_edits_but_uses_generated_categories():
+ existing = """## What's Changed
+### Bug Fixes πŸ›
+* Carefully copy-edited note by {user}`alice` in {pr}`1`
+
+ A manually added description.
+* Existing note by {user}`bob` in {pr}`2`
+* Obsolete note by {user}`dave` in {pr}`4`
+
+## New Contributors
+* {user}`alice` made their first contribution in {pr}`1`
+"""
+ generated = """## What's Changed
+### Enhancements πŸš€
+* Original generated note by {user}`alice` in {pr}`1`
+* Newly merged PR by {user}`carol` in {pr}`3`
+
+### Bug Fixes πŸ›
+* Regenerated note by {user}`bob` in {pr}`2`
+
+## New Contributors
+* {user}`alice` made their first contribution in {pr}`1`
+* {user}`carol` made their first contribution in {pr}`3`
+"""
+
+ merged = merge_changelog(generated, existing)
+
+ assert "Carefully copy-edited note" in merged
+ assert "A manually added description." in merged
+ assert "Original generated note" not in merged
+ assert "Newly merged PR" in merged
+ assert "Obsolete note" not in merged
+ assert merged.index("### Enhancements") < merged.index("Carefully copy-edited note")
+ assert merged.index("Carefully copy-edited note") < merged.index("### Bug Fixes")
+
+
+def test_merge_changelog_keeps_release_and_contributor_entries_separate():
+ existing = """## What's Changed
+### Enhancements
+* Edited release note in {pr}`10`
+
+## New Contributors
+* Edited welcome for the author of {pr}`10`
+
+**Full Changelog**: existing compare link
+"""
+ generated = """## What's Changed
+### Documentation
+* Generated release note in {pr}`10`
+
+## New Contributors
+* Generated welcome for the author of {pr}`10`
+* Welcome for the author of {pr}`11`
+
+**Full Changelog**: generated compare link
+"""
+
+ merged = merge_changelog(generated, existing)
+
+ assert "Edited release note" in merged
+ assert "Edited welcome" in merged
+ assert "Generated release note" not in merged
+ assert "Generated welcome" not in merged
+ assert merged.count("{pr}`10`") == 2
+ assert "Welcome for the author of {pr}`11`" in merged
+ assert merged.count("**Full Changelog**") == 1
+ assert "generated compare link" in merged
+
+
+def test_include_extra_pull_requests_adds_other_changes_category(monkeypatch):
+ body = """## What's Changed
+### Bug Fixes
+* Fix a bug by @alice in https://github.com/ManimCommunity/manim/pull/1
+
+## New Contributors
+* @alice made their first contribution in https://github.com/ManimCommunity/manim/pull/1
+
+**Full Changelog**: compare link
+"""
+ monkeypatch.setattr(
+ release,
+ "get_pull_request_release_note",
+ lambda number: (
+ f"* Prepare a release by @bob in "
+ f"https://github.com/ManimCommunity/manim/pull/{number}"
+ ),
+ )
+
+ result = include_extra_pull_requests(body, [99])
+
+ assert "### Other Changes\n* Prepare a release by @bob" in result
+ assert result.index("### Other Changes") < result.index("## New Contributors")
+
+
+def test_include_extra_pull_requests_skips_existing_pr(monkeypatch):
+ body = """## What's Changed
+### Other Changes
+* Existing entry in https://github.com/ManimCommunity/manim/pull/99
+"""
+
+ def fail_if_called(number):
+ raise AssertionError(f"unexpected fetch for #{number}")
+
+ monkeypatch.setattr(release, "get_pull_request_release_note", fail_if_called)
+
+ assert include_extra_pull_requests(body, [99]) == body
+
+
+def test_merge_changelog_without_matching_entries_is_unchanged():
+ generated = """## What's Changed
+### New Features
+* A new entry in {pr}`42`
+"""
+
+ assert merge_changelog(generated, "") == generated
+
+
+def test_format_github_release_notes_removes_docs_metadata_and_converts_roles():
+ changelog = """---
+short-title: v1.2.3
+description: Changelog for v1.2.3
+---
+
+# v1.2.3
+
+Date
+: January 02, 2026
+
+## What's Changed
+* Improve {class}`.Example` by {user}`alice` in {pr}`123`
+* Fix {issue}`456`
+
+**Full Changelog**: [Compare view](https://example.com/compare)
+"""
+
+ result = format_github_release_notes("1.2.3", changelog)
+
+ assert result.startswith(
+ "See [our rendered changelog](https://docs.manim.community/en/stable/"
+ "changelog/1.2.3-changelog.html).\n\n## What's Changed"
+ )
+ assert "frontmatter" not in result
+ assert "# v1.2.3" not in result
+ assert "January 02, 2026" not in result
+ assert "`Example` by @alice" in result
+ assert "https://github.com/manimcommunity/manim/pull/123" in result
+ assert "https://github.com/manimcommunity/manim/issues/456" in result
+ assert result.endswith("\n")
diff --git a/uv.lock b/uv.lock
index b3de74a98..854d87c49 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1397,7 +1397,7 @@ wheels = [
[[package]]
name = "manim"
-version = "0.20.1"
+version = "0.21.0"
source = { editable = "." }
dependencies = [
{ name = "audioop-lts", marker = "python_full_version >= '3.13'" },