From ee23ce6cc8e68e811694da8f475d7a4bef4cb33b Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 28 Jan 2024 00:31:51 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=92=85=20Indent=20Towncrier=20config?= =?UTF-8?q?=20section=20(two-space)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1f590d002ef..b06d30ab564 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,12 +5,12 @@ requires = [ build-backend = "setuptools.build_meta" [tool.towncrier] -package = "aiohttp" -filename = "CHANGES.rst" -directory = "CHANGES/" -title_format = "{version} ({project_date})" -template = "CHANGES/.TEMPLATE.rst" -issue_format = "`#{issue} `_" + package = "aiohttp" + filename = "CHANGES.rst" + directory = "CHANGES/" + title_format = "{version} ({project_date})" + template = "CHANGES/.TEMPLATE.rst" + issue_format = "`#{issue} `_" [tool.cibuildwheel] From e5920dea287a2bbc251fdf7a3f901aa2d7164040 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 28 Jan 2024 00:43:10 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=92=85=20Render=20PR/issue=20refs=20@?= =?UTF-8?q?=20changelog=20more=20clearly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also implements support for commits as change note references. They are rendered separately. When there are several change note fragment files symlinked, with numbers and commit hashes pointing to the same changelog category, all of them are enumerated. PRs/issue numbers a listed in a paragraph that is separate from the commit links. --- .github/workflows/ci-cd.yml | 6 +++-- .pre-commit-config.yaml | 16 +++++++++++- CHANGES/.TEMPLATE.rst | 52 ++++++++++++++++++++++++++++++++++--- pyproject.toml | 2 +- 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a7d681e806e..8ee26658c9b 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -436,8 +436,10 @@ jobs: version_file: aiohttp/__init__.py github_token: ${{ secrets.GITHUB_TOKEN }} dist_dir: dist - fix_issue_regex: "`#(\\d+) `_" - fix_issue_repl: "(#\\1)" + fix_issue_regex: >- + :issue:`(\d+)` + fix_issue_repl: >- + #\1 - name: >- Publish 🐍📦 to PyPI diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be1fbae1ffc..1d1bf1cd80a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,21 @@ repos: Changelog files must be named ####.(bugfix|feature|removal|doc|misc)(.#)?(.rst)? exclude: >- - ^CHANGES/(\.TEMPLATE\.rst|\.gitignore|\d+\.(bugfix|feature|removal|doc|misc)(\.\d+)?(\.rst)?|README\.rst)$ + (?x) + ^ + CHANGES/( + \.gitignore + |(\d+|[0-9a-f]{8}|[0-9a-f]{7}|[0-9a-f]{40})\.( + bugfix + |feature + |removal + |doc + |misc + )(\.\d+)?(\.rst)? + |README\.rst + |\.TEMPLATE\.rst + ) + $ files: ^CHANGES/ - id: changelogs-user-role name: Changelog files should use a non-broken :user:`name` role diff --git a/CHANGES/.TEMPLATE.rst b/CHANGES/.TEMPLATE.rst index a27a1994b53..9334cefd84f 100644 --- a/CHANGES/.TEMPLATE.rst +++ b/CHANGES/.TEMPLATE.rst @@ -11,11 +11,56 @@ {{ underline * definitions[category]['name']|length }} {% if definitions[category]['showcontent'] %} -{% for text, values in sections[section][category].items() %} +{% for text, change_note_refs in sections[section][category].items() %} - {{ text + '\n' }} - {{ values|join(',\n ') + '\n' }} -{% endfor %} + {# + NOTE: Replacing 'e' with 'f' is a hack that prevents Jinja's `int` + NOTE: filter internal implementation from treating the input as an + NOTE: infinite float when it looks like a scientific notation (with a + NOTE: single 'e' char in between digits), raising an `OverflowError`, + NOTE: subsequently. 'f' is still a hex letter so it won't affect the + NOTE: check for whether it's a (short or long) commit hash or not. + Ref: https://github.com/pallets/jinja/issues/1921 + -#} + {%- + set pr_issue_numbers = change_note_refs + | map('lower') + | map('replace', 'e', 'f') + | map('int', default=None) + | select('integer') + | map('string') + | list + -%} + {%- set arbitrary_refs = [] -%} + {%- set commit_refs = [] -%} + {%- with -%} + {%- set commit_ref_candidates = change_note_refs | reject('in', pr_issue_numbers) -%} + {%- for cf in commit_ref_candidates -%} + {%- if cf | length in (7, 8, 40) and cf | int(default=None, base=16) is not none -%} + {%- set _ = commit_refs.append(cf) -%} + {%- else -%} + {%- set _ = arbitrary_refs.append(cf) -%} + {%- endif -%} + {%- endfor -%} + {%- endwith -%} + + {% if pr_issue_numbers -%} + *Related issues and pull requests on GitHub:* + :issue:`{{ pr_issue_numbers | join('`, :issue:`') }}`. + {% endif %} + + {% if commit_refs -%} + *Related commits on GitHub:* + :commit:`{{ commit_refs | join('`, :commit:`') }}`. + {% endif %} + + {% if arbitrary_refs -%} + *Unlinked references:* + {{ arbitrary_refs | join(', ') }}`. + {% endif %} + +{% endfor %} {% else %} - {{ sections[section][category]['']|join(', ') }} @@ -34,3 +79,4 @@ No significant changes. {% endif %} {% endfor %} ---- +{{ '\n' * 2 }} diff --git a/pyproject.toml b/pyproject.toml index b06d30ab564..cebfaccc64f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta" directory = "CHANGES/" title_format = "{version} ({project_date})" template = "CHANGES/.TEMPLATE.rst" - issue_format = "`#{issue} `_" + issue_format = "{issue}" [tool.cibuildwheel] From 1260724bdf9141f2f12650ffff86e88cb035eb41 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 28 Jan 2024 00:49:03 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=92=85=20Introduce=20more=20accurate?= =?UTF-8?q?=20changelog=20categories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifically, the new Towncrier fragment types are set up to be `bugfix`, `feature`, `deprecation`, `breaking`, `doc`, `packaging`, `contrib`, `misc`. Previously, the `misc` fragments were rendered without the entry context, just as a list of PR numbers. With this change, the change note text is displayed as usual. --- .github/PULL_REQUEST_TEMPLATE.md | 42 ++++++++++---- .pre-commit-config.yaml | 16 +++++- CHANGES/.gitignore | 27 +++++++++ CHANGES/{2835.removal => 2835.breaking.rst} | 0 CHANGES/{2977.removal => 2977.breaking.rst} | 0 CHANGES/{3463.removal => 3463.breaking.rst} | 0 CHANGES/{3538.removal => 3538.breaking.rst} | 0 CHANGES/{3539.removal => 3539.breaking.rst} | 0 CHANGES/{3542.removal => 3542.breaking.rst} | 0 CHANGES/{3547.removal => 3547.breaking.rst} | 0 CHANGES/{3548.removal => 3548.breaking.rst} | 0 CHANGES/{3580.removal => 3580.breaking.rst} | 0 CHANGES/{3890.removal => 3890.breaking.rst} | 0 CHANGES/{3901.removal => 3901.breaking.rst} | 0 CHANGES/{3929.removal => 3929.breaking.rst} | 0 CHANGES/{3931.removal => 3931.breaking.rst} | 0 CHANGES/{3932.removal => 3932.breaking.rst} | 0 CHANGES/{3933.removal => 3933.breaking.rst} | 0 CHANGES/{3934.removal => 3934.breaking.rst} | 0 CHANGES/{3935.removal => 3935.breaking.rst} | 0 CHANGES/{3939.removal => 3939.breaking.rst} | 0 CHANGES/{3940.removal => 3940.breaking.rst} | 0 CHANGES/{3942.removal => 3942.breaking.rst} | 0 CHANGES/{3945.removal => 3945.breaking.rst} | 0 CHANGES/{3948.removal => 3948.breaking.rst} | 0 CHANGES/{5278.removal => 5278.breaking.rst} | 0 CHANGES/{5284.removal => 5284.breaking.rst} | 0 CHANGES/{7107.removal => 7107.breaking.rst} | 0 CHANGES/{8048.removal => 8048.breaking.rst} | 0 CHANGES/README.rst | 25 +++++++-- pyproject.toml | 61 +++++++++++++++++++++ tools/check_changes.py | 17 +++++- tools/cleanup_changes.py | 24 ++++++-- 33 files changed, 187 insertions(+), 25 deletions(-) rename CHANGES/{2835.removal => 2835.breaking.rst} (100%) rename CHANGES/{2977.removal => 2977.breaking.rst} (100%) rename CHANGES/{3463.removal => 3463.breaking.rst} (100%) rename CHANGES/{3538.removal => 3538.breaking.rst} (100%) rename CHANGES/{3539.removal => 3539.breaking.rst} (100%) rename CHANGES/{3542.removal => 3542.breaking.rst} (100%) rename CHANGES/{3547.removal => 3547.breaking.rst} (100%) rename CHANGES/{3548.removal => 3548.breaking.rst} (100%) rename CHANGES/{3580.removal => 3580.breaking.rst} (100%) rename CHANGES/{3890.removal => 3890.breaking.rst} (100%) rename CHANGES/{3901.removal => 3901.breaking.rst} (100%) rename CHANGES/{3929.removal => 3929.breaking.rst} (100%) rename CHANGES/{3931.removal => 3931.breaking.rst} (100%) rename CHANGES/{3932.removal => 3932.breaking.rst} (100%) rename CHANGES/{3933.removal => 3933.breaking.rst} (100%) rename CHANGES/{3934.removal => 3934.breaking.rst} (100%) rename CHANGES/{3935.removal => 3935.breaking.rst} (100%) rename CHANGES/{3939.removal => 3939.breaking.rst} (100%) rename CHANGES/{3940.removal => 3940.breaking.rst} (100%) rename CHANGES/{3942.removal => 3942.breaking.rst} (100%) rename CHANGES/{3945.removal => 3945.breaking.rst} (100%) rename CHANGES/{3948.removal => 3948.breaking.rst} (100%) rename CHANGES/{5278.removal => 5278.breaking.rst} (100%) rename CHANGES/{5284.removal => 5284.breaking.rst} (100%) rename CHANGES/{7107.removal => 7107.breaking.rst} (100%) rename CHANGES/{8048.removal => 8048.breaking.rst} (100%) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3ac54a518b5..686f70cd975 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -21,13 +21,35 @@ - [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt` * The format is <Name> <Surname>. * Please keep alphabetical order, the file is sorted by names. -- [ ] Add a new news fragment into the `CHANGES` folder - * name it `.` for example (588.bugfix) - * if you don't have an `issue_id` change it to the pr id after creating the pr - * ensure type is one of the following: - * `.feature`: Signifying a new feature. - * `.bugfix`: Signifying a bug fix. - * `.doc`: Signifying a documentation improvement. - * `.removal`: Signifying a deprecation or removal of public API. - * `.misc`: A ticket has been closed, but it is not of interest to users. - * Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files." +- [ ] Add a new news fragment into the `CHANGES/` folder + * name it `..rst` (e.g. `588.bugfix.rst`) + * if you don't have an issue number, change it to the pull request + number after creating the PR + * `.bugfix`: A bug fix for something the maintainers deemed an + improper undesired behavior that got corrected to match + pre-agreed expectations. + * `.feature`: A new behavior, public APIs. That sort of stuff. + * `.deprecation`: A declaration of future API removals and breaking + changes in behavior. + * `.breaking`: When something public is removed in a breaking way. + Could be deprecated in an earlier release. + * `.doc`: Notable updates to the documentation structure or build + process. + * `.packaging`: Notes for downstreams about unobvious side effects + and tooling. Changes in the test invocation considerations and + runtime assumptions. + * `.contrib`: Stuff that affects the contributor experience. e.g. + Running tests, building the docs, setting up the development + environment. + * `.misc`: Changes that are hard to assign to any of the above + categories. + * Make sure to use full sentences with correct case and punctuation, + for example: + ```rst + Fixed issue with non-ascii contents in doctest text files + -- by :user:`contributor-gh-handle`. + ``` + + Use the past tense or the present tense a non-imperative mood, + referring to what's changed compared to the last released version + of this project. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1d1bf1cd80a..8820239992c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,16 @@ repos: language: fail entry: >- Changelog files must be named - ####.(bugfix|feature|removal|doc|misc)(.#)?(.rst)? + ####.( + bugfix + | feature + | deprecation + | breaking + | doc + | packaging + | contrib + | misc + )(.#)?(.rst)? exclude: >- (?x) ^ @@ -15,8 +24,11 @@ repos: |(\d+|[0-9a-f]{8}|[0-9a-f]{7}|[0-9a-f]{40})\.( bugfix |feature - |removal + |deprecation + |breaking |doc + |packaging + |contrib |misc )(\.\d+)?(\.rst)? |README\.rst diff --git a/CHANGES/.gitignore b/CHANGES/.gitignore index f935021a8f8..d6409a0dd82 100644 --- a/CHANGES/.gitignore +++ b/CHANGES/.gitignore @@ -1 +1,28 @@ +* +!.TEMPLATE.rst !.gitignore +!README.rst +!*.bugfix +!*.bugfix.rst +!*.bugfix.*.rst +!*.breaking +!*.breaking.rst +!*.breaking.*.rst +!*.contrib +!*.contrib.rst +!*.contrib.*.rst +!*.deprecation +!*.deprecation.rst +!*.deprecation.*.rst +!*.doc +!*.doc.rst +!*.doc.*.rst +!*.feature +!*.feature.rst +!*.feature.*.rst +!*.misc +!*.misc.rst +!*.misc.*.rst +!*.packaging +!*.packaging.rst +!*.packaging.*.rst diff --git a/CHANGES/2835.removal b/CHANGES/2835.breaking.rst similarity index 100% rename from CHANGES/2835.removal rename to CHANGES/2835.breaking.rst diff --git a/CHANGES/2977.removal b/CHANGES/2977.breaking.rst similarity index 100% rename from CHANGES/2977.removal rename to CHANGES/2977.breaking.rst diff --git a/CHANGES/3463.removal b/CHANGES/3463.breaking.rst similarity index 100% rename from CHANGES/3463.removal rename to CHANGES/3463.breaking.rst diff --git a/CHANGES/3538.removal b/CHANGES/3538.breaking.rst similarity index 100% rename from CHANGES/3538.removal rename to CHANGES/3538.breaking.rst diff --git a/CHANGES/3539.removal b/CHANGES/3539.breaking.rst similarity index 100% rename from CHANGES/3539.removal rename to CHANGES/3539.breaking.rst diff --git a/CHANGES/3542.removal b/CHANGES/3542.breaking.rst similarity index 100% rename from CHANGES/3542.removal rename to CHANGES/3542.breaking.rst diff --git a/CHANGES/3547.removal b/CHANGES/3547.breaking.rst similarity index 100% rename from CHANGES/3547.removal rename to CHANGES/3547.breaking.rst diff --git a/CHANGES/3548.removal b/CHANGES/3548.breaking.rst similarity index 100% rename from CHANGES/3548.removal rename to CHANGES/3548.breaking.rst diff --git a/CHANGES/3580.removal b/CHANGES/3580.breaking.rst similarity index 100% rename from CHANGES/3580.removal rename to CHANGES/3580.breaking.rst diff --git a/CHANGES/3890.removal b/CHANGES/3890.breaking.rst similarity index 100% rename from CHANGES/3890.removal rename to CHANGES/3890.breaking.rst diff --git a/CHANGES/3901.removal b/CHANGES/3901.breaking.rst similarity index 100% rename from CHANGES/3901.removal rename to CHANGES/3901.breaking.rst diff --git a/CHANGES/3929.removal b/CHANGES/3929.breaking.rst similarity index 100% rename from CHANGES/3929.removal rename to CHANGES/3929.breaking.rst diff --git a/CHANGES/3931.removal b/CHANGES/3931.breaking.rst similarity index 100% rename from CHANGES/3931.removal rename to CHANGES/3931.breaking.rst diff --git a/CHANGES/3932.removal b/CHANGES/3932.breaking.rst similarity index 100% rename from CHANGES/3932.removal rename to CHANGES/3932.breaking.rst diff --git a/CHANGES/3933.removal b/CHANGES/3933.breaking.rst similarity index 100% rename from CHANGES/3933.removal rename to CHANGES/3933.breaking.rst diff --git a/CHANGES/3934.removal b/CHANGES/3934.breaking.rst similarity index 100% rename from CHANGES/3934.removal rename to CHANGES/3934.breaking.rst diff --git a/CHANGES/3935.removal b/CHANGES/3935.breaking.rst similarity index 100% rename from CHANGES/3935.removal rename to CHANGES/3935.breaking.rst diff --git a/CHANGES/3939.removal b/CHANGES/3939.breaking.rst similarity index 100% rename from CHANGES/3939.removal rename to CHANGES/3939.breaking.rst diff --git a/CHANGES/3940.removal b/CHANGES/3940.breaking.rst similarity index 100% rename from CHANGES/3940.removal rename to CHANGES/3940.breaking.rst diff --git a/CHANGES/3942.removal b/CHANGES/3942.breaking.rst similarity index 100% rename from CHANGES/3942.removal rename to CHANGES/3942.breaking.rst diff --git a/CHANGES/3945.removal b/CHANGES/3945.breaking.rst similarity index 100% rename from CHANGES/3945.removal rename to CHANGES/3945.breaking.rst diff --git a/CHANGES/3948.removal b/CHANGES/3948.breaking.rst similarity index 100% rename from CHANGES/3948.removal rename to CHANGES/3948.breaking.rst diff --git a/CHANGES/5278.removal b/CHANGES/5278.breaking.rst similarity index 100% rename from CHANGES/5278.removal rename to CHANGES/5278.breaking.rst diff --git a/CHANGES/5284.removal b/CHANGES/5284.breaking.rst similarity index 100% rename from CHANGES/5284.removal rename to CHANGES/5284.breaking.rst diff --git a/CHANGES/7107.removal b/CHANGES/7107.breaking.rst similarity index 100% rename from CHANGES/7107.removal rename to CHANGES/7107.breaking.rst diff --git a/CHANGES/8048.removal b/CHANGES/8048.breaking.rst similarity index 100% rename from CHANGES/8048.removal rename to CHANGES/8048.breaking.rst diff --git a/CHANGES/README.rst b/CHANGES/README.rst index 9f619296351..bf467d2bc07 100644 --- a/CHANGES/README.rst +++ b/CHANGES/README.rst @@ -43,7 +43,7 @@ with your own!). Finally, name your file following the convention that Towncrier understands: it should start with the number of an issue or a PR followed by a dot, then add a patch type, like ``feature``, -``doc``, ``misc`` etc., and add ``.rst`` as a suffix. If you +``doc``, ``contrib`` etc., and add ``.rst`` as a suffix. If you need to add more than one fragment, you may add an optional sequence number (delimited with another period) between the type and the suffix. @@ -51,11 +51,24 @@ and the suffix. In general the name will follow ``..rst`` pattern, where the categories are: -- ``feature``: Any new feature -- ``bugfix``: A bug fix -- ``doc``: A change to the documentation -- ``misc``: Changes internal to the repo like CI, test and build changes -- ``removal``: For deprecations and removals of an existing feature or behavior +- ``bugfix``: A bug fix for something we deemed an improper undesired + behavior that got corrected in the release to match pre-agreed + expectations. +- ``feature``: A new behavior, public APIs. That sort of stuff. +- ``deprecation``: A declaration of future API removals and breaking + changes in behavior. +- ``breaking``: When something public gets removed in a breaking way. + Could be deprecated in an earlier release. +- ``doc``: Notable updates to the documentation structure or build + process. +- ``packaging``: Notes for downstreams about unobvious side effects + and tooling. Changes in the test invocation considerations and + runtime assumptions. +- ``contrib``: Stuff that affects the contributor experience. e.g. + Running tests, building the docs, setting up the development + environment. +- ``misc``: Changes that are hard to assign to any of the above + categories. A pull request may have more than one of these components, for example a code change may introduce a new feature that deprecates an old diff --git a/pyproject.toml b/pyproject.toml index cebfaccc64f..85d7c87eb34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,67 @@ build-backend = "setuptools.build_meta" template = "CHANGES/.TEMPLATE.rst" issue_format = "{issue}" + # NOTE: The types are declared because: + # NOTE: - there is no mechanism to override just the value of + # NOTE: `tool.towncrier.type.misc.showcontent`; + # NOTE: - and, we want to declare extra non-default types for + # NOTE: clarity and flexibility. + + [[tool.towncrier.section]] + path = "" + + [[tool.towncrier.type]] + # Something we deemed an improper undesired behavior that got corrected + # in the release to match pre-agreed expectations. + directory = "bugfix" + name = "Bug fixes" + showcontent = true + + [[tool.towncrier.type]] + # New behaviors, public APIs. That sort of stuff. + directory = "feature" + name = "Features" + showcontent = true + + [[tool.towncrier.type]] + # Declarations of future API removals and breaking changes in behavior. + directory = "deprecation" + name = "Deprecations (removal in next major release)" + showcontent = true + + [[tool.towncrier.type]] + # When something public gets removed in a breaking way. Could be + # deprecated in an earlier release. + directory = "breaking" + name = "Removals and backward incompatible breaking changes" + showcontent = true + + [[tool.towncrier.type]] + # Notable updates to the documentation structure or build process. + directory = "doc" + name = "Improved documentation" + showcontent = true + + [[tool.towncrier.type]] + # Notes for downstreams about unobvious side effects and tooling. Changes + # in the test invocation considerations and runtime assumptions. + directory = "packaging" + name = "Packaging updates and notes for downstreams" + showcontent = true + + [[tool.towncrier.type]] + # Stuff that affects the contributor experience. e.g. Running tests, + # building the docs, setting up the development environment. + directory = "contrib" + name = "Contributor-facing changes" + showcontent = true + + [[tool.towncrier.type]] + # Changes that are hard to assign to any of the above categories. + directory = "misc" + name = "Miscellaneous internal changes" + showcontent = true + [tool.cibuildwheel] test-command = "" diff --git a/tools/check_changes.py b/tools/check_changes.py index 91db8b92572..6cc4d050cd8 100755 --- a/tools/check_changes.py +++ b/tools/check_changes.py @@ -4,8 +4,21 @@ import sys from pathlib import Path -ALLOWED_SUFFIXES = ["feature", "bugfix", "doc", "removal", "misc"] -PATTERN = re.compile(r"\d+\.(" + "|".join(ALLOWED_SUFFIXES) + r")(\.\d+)?(\.rst)?") +ALLOWED_SUFFIXES = ( + "bugfix", + "feature", + "deprecation", + "breaking", + "doc", + "packaging", + "contrib", + "misc", +) +PATTERN = re.compile( + r"(\d+|[0-9a-f]{8}|[0-9a-f]{7}|[0-9a-f]{40})\.(" + + "|".join(ALLOWED_SUFFIXES) + + r")(\.\d+)?(\.rst)?", +) def get_root(script_path): diff --git a/tools/cleanup_changes.py b/tools/cleanup_changes.py index 673866b8d67..5b931138056 100755 --- a/tools/cleanup_changes.py +++ b/tools/cleanup_changes.py @@ -7,8 +7,21 @@ import subprocess from pathlib import Path -ALLOWED_SUFFIXES = ["feature", "bugfix", "doc", "removal", "misc"] -PATTERN = re.compile(r"(\d+)\.(" + "|".join(ALLOWED_SUFFIXES) + r")(\.\d+)?(\.rst)?") +ALLOWED_SUFFIXES = ( + "bugfix", + "feature", + "deprecation", + "breaking", + "doc", + "packaging", + "contrib", + "misc", +) +PATTERN = re.compile( + r"(\d+|[0-9a-f]{8}|[0-9a-f]{7}|[0-9a-f]{40})\.(" + + "|".join(ALLOWED_SUFFIXES) + + r")(\.\d+)?(\.rst)?", +) def main(): @@ -18,9 +31,10 @@ def main(): for fname in (root / "CHANGES").iterdir(): match = PATTERN.match(fname.name) if match is not None: - num = match.group(1) - tst = f"`#{num} `_" - if tst in changes: + commit_issue_or_pr = match.group(1) + tst_issue_or_pr = f":issue:`{commit_issue_or_pr}`" + tst_commit = f":commit:`{commit_issue_or_pr}`" + if tst_issue_or_pr in changes or tst_commit in changes: subprocess.run(["git", "rm", fname]) delete.append(fname.name) print("Deleted CHANGES records:", " ".join(delete)) From 6e44580d13b2cb54f767e6b4f9dd7144c7046cae Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 28 Jan 2024 03:08:03 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=93=9D=20Mark=20known=20words=20from?= =?UTF-8?q?=20change=20notes=20to=20known?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spelling_wordlist.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 145a7f187ca..d776db14506 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -18,6 +18,7 @@ async asyncio asyncpg asynctest +attrs auth autocalculated autodetection @@ -35,6 +36,7 @@ backports BaseEventLoop basename BasicAuth +behaviour BodyPartReader boolean botocore @@ -90,6 +92,7 @@ Cythonize cythonized de deduplicate +defs Dependabot deprecations DER @@ -105,6 +108,7 @@ DNSResolver docstring docstrings DoS +downstreams Dup elasticsearch encodings @@ -314,6 +318,8 @@ Testsuite Tf timestamps TLS +tmp +tmpdir toolbar toplevel towncrier @@ -330,6 +336,7 @@ Unittest unix unsets unstripped +untyped uppercased upstr url From a2a4a929fe98df7144fa84ffd304cc06fd9d1826 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 28 Jan 2024 02:42:22 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=93=9D=20Add=20a=20change=20note=20fo?= =?UTF-8?q?r=20PR=20#8066?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES/8066.contrib.rst | 21 +++++++++++++++++++++ CHANGES/8066.packaging.rst | 1 + 2 files changed, 22 insertions(+) create mode 100644 CHANGES/8066.contrib.rst create mode 120000 CHANGES/8066.packaging.rst diff --git a/CHANGES/8066.contrib.rst b/CHANGES/8066.contrib.rst new file mode 100644 index 00000000000..2468018e99b --- /dev/null +++ b/CHANGES/8066.contrib.rst @@ -0,0 +1,21 @@ +The changelog categorization was made clearer. The +contributors can now mark their fragment files more +accurately -- by :user:`webknjaz`. + +The new category tags are: + + * ``bugfix`` + + * ``feature`` + + * ``deprecation`` + + * ``breaking`` (previously, ``removal``) + + * ``doc`` + + * ``packaging`` + + * ``contrib`` + + * ``misc`` diff --git a/CHANGES/8066.packaging.rst b/CHANGES/8066.packaging.rst new file mode 120000 index 00000000000..57cdff225f5 --- /dev/null +++ b/CHANGES/8066.packaging.rst @@ -0,0 +1 @@ +8066.contrib.rst \ No newline at end of file