From 1fe70ab41c3add16cc1752929cbd8aee8d08c42b Mon Sep 17 00:00:00 2001 From: Anders <6058745+ddabble@users.noreply.github.com> Date: Wed, 29 May 2024 19:25:41 +0200 Subject: [PATCH] Replaced PyPI comments in CHANGES.rst with a regex This avoids having to move the comments in `CHANGES.rst` *every* time we're preparing a new release. --- CHANGES.rst | 3 --- pyproject.toml | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index a9e2a854..ebe9a79f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,9 +5,6 @@ Unreleased ---------- -.. DEV: Move these comments just below the "Unreleased" section when preparing a new release! -.. Start of PyPI readme - 3.7.0 (2024-05-29) ------------------ diff --git a/pyproject.toml b/pyproject.toml index bd1ddec5..319078fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,10 +70,14 @@ core-metadata-version = "2.2" [tool.hatch.metadata.hooks.fancy-pypi-readme] content-type = "text/x-rst" +# (Preview the generated readme by installing `hatch` and running +# `hatch project metadata readme` - see +# https://github.com/hynek/hatch-fancy-pypi-readme/blob/24.1.0/README.md#cli-interface) fragments = [ { path = "README.rst", start-after = ".. Start of PyPI readme\n\n" }, { text = "\n====\n\nChangelog\n=========\n\n" }, - { path = "CHANGES.rst", start-after = ".. Start of PyPI readme\n\n" }, + # Only include the first title after "Unreleased" - as well as the rest of the file + { path = "CHANGES.rst", pattern = "\nUnreleased\n-{4,}\n(?:.*?)\n([^\n]+\n-{4,}\n.*)" }, ] [tool.black]