Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
21 changes: 21 additions & 0 deletions .github/scripts/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
# (here saved to base.rst) does not have, ending with its PR and author.
# Used by the Changelog workflow.
python .github/scripts/changelog.py check base.rst

# Check that every entry in the changelog, old or new, ends with its PR and
# author. Used by the Changelog workflow, also on PRs that need no new entry.
python .github/scripts/changelog.py lint
"""

import argparse
Expand Down Expand Up @@ -296,6 +300,19 @@ def check(base_path):
print(f" {entry}")


def lint():
"""Exit with an error unless every entry in the changelog ends with its PR and author."""
_, sections = split_sections(CHANGELOG.read_text())
unattributed = [
entry for _, body in sections for entry in entries(body) if not ATTRIBUTION.search(entry)
]
if unattributed:
sys.exit(
"end each entry with (:gh:`<PR number>` by :user:`<GitHub handle>`):\n"
+ "\n".join(f" {entry}" for entry in unattributed)
)


def main():
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
Expand All @@ -318,11 +335,15 @@ def main():
"check", help="check that 'Current' has a new entry compared to a base changelog"
)
check_parser.add_argument("base", help="the changelog of the base branch")
commands.add_parser("lint", help="check that every entry ends with its PR and author")
args = parser.parse_args()

if args.command == "check":
check(args.base)
return
if args.command == "lint":
lint()
return
version = args.version.strip().removeprefix("v")
if not VERSION.fullmatch(version):
sys.exit(
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Changes that users do not notice need no entry: label the PR `dev` (CI,
# dependency bumps; Dependabot adds it), `documentation` or `skip changelog`, and
# the check passes. It re-runs when labels change, so adding one fixes a red check.
# Every PR, labelled or not, also checks that all entries end with their PR and
# author, so a broken edit to an existing entry fails here instead of in the tests.
name: Changelog

on:
Expand All @@ -19,6 +21,22 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# The default checkout is the PR merged into its base branch. The first parent
# of that merge commit is the base it merged against, so comparing with it
# shows exactly the entries this PR adds.
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 2
persist-credentials: false

- name: Check that every entry names its PR and author
run: |
if ! python3 .github/scripts/changelog.py lint; then
echo "::error::End every entry in docs/source/changelog.rst with (:gh:\`<PR number>\` by :user:\`<GitHub handle>\`), including the backticks."
exit 1
fi

- name: Check for a skip label
id: labels
env:
Expand All @@ -34,16 +52,6 @@ jobs:
done
echo "skip=false" >> "$GITHUB_OUTPUT"

# The default checkout is the PR merged into its base branch. The first parent
# of that merge commit is the base it merged against, so comparing with it
# shows exactly the entries this PR adds.
- name: Checkout repository
if: steps.labels.outputs.skip == 'false'
uses: actions/checkout@v7
with:
fetch-depth: 2
persist-credentials: false

- name: Check for a new entry under Current
if: steps.labels.outputs.skip == 'false'
run: |
Expand Down
15 changes: 14 additions & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ This changelog is for the ``main`` branch. It lists the changes in each release,
Current
-------

New Features
^^^^^^^^^^^^

Changed
^^^^^^^

Fixed
^^^^^


v0.1.9 (2026-11-10)
-------------------

New Features
^^^^^^^^^^^^
- ADMIRE (Aperture Domain Model Image REconstruction), a model-based beamformer that suppresses off-axis and multipath clutter, as :class:`zea.ops.ADMIRE` or ``zea.ops.Beamform(beamformer="admire")``. See :mod:`zea.beamform.admire` (:gh:`650` by :user:`tristan-deep`)
Expand Down Expand Up @@ -55,7 +68,7 @@ Fixed
- Deriving ``xlims`` on a GPU with the torch backend (:gh:`661` by :user:`tristan-deep`)
- Jitted ops on the torch backend in the Docker images, which lacked a C++ compiler (:gh:`658` by :user:`wesselvannierop`)
- ``zea app`` and ``load_model_from_hf`` download to the zea cache instead of the Hugging Face cache (:gh:`689` by :user:`Louisvh`)
- The cache key of a ``@cache_output`` function includes the source of other cached functions it calls, so editing those functions invalidates its cached results (:gh:`703` by :user:`wesselvannierop`)
- ``@cache_output`` functions that call a recursive function can now be cached. Additionally, the cache key now also includes other ``@cache_output`` functions it calls, so editing those invalidates its cache (:gh:`703` by :user:`wesselvannierop`)


v0.1.8 (2026-10-01)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "zea"
version = "0.1.8"
version = "0.1.9"
description = "A Toolbox for Cognitive Ultrasound Imaging. Provides a set of tools for processing of ultrasound data, all built in your favorite machine learning framework."
authors = [
{ name = "Tristan Stevens", email = "t.s.w.stevens@tue.nl" },
Expand Down
20 changes: 12 additions & 8 deletions tests/test_changelog_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,19 @@ def test_entries_join_wrapped_lines():
assert changelog.entries(body) == ["- One that wraps onto a second line", "- Another"]


def test_lint_requires_every_entry_to_be_attributed(changelog_file):
"""Unlike `check`, `lint` also catches an edit that breaks an existing entry."""
changelog_file.write_text(make_changelog(ENTRY))
changelog.lint()

changelog_file.write_text(make_changelog(ENTRY).replace("(:gh:`637`", "(:gh:637"))
with pytest.raises(SystemExit, match="An older fix"):
changelog.lint()


def test_every_entry_in_the_changelog_is_attributed():
"""The real changelog follows the format the check enforces on new entries."""
_, sections = changelog.split_sections(changelog.CHANGELOG.read_text())
unattributed = [
entry
for _, body in sections
for entry in changelog.entries(body)
if not changelog.ATTRIBUTION.search(entry)
]
assert not unattributed
changelog.lint()


def test_load_inventory(tmp_path):
Expand Down Expand Up @@ -268,6 +271,7 @@ def run(*args):
base.write_text(make_changelog())

run("check", str(base))
run("lint")
run("release", "v0.1.9", "--date", "2026-11-05")
assert "v0.1.9 (2026-11-05)" in changelog_file.read_text()

Expand Down
Loading
Loading