Skip to content

Commit 0ef5a40

Browse files
authored
🐛 fix(release): format generated changelog (#1170)
Format the generated changelog with [docstrfmt 2.2.1](https://github.com/LilSpazJoekp/docstrfmt/releases/tag/v2.2.1) before creating a release commit. v2.2.0 skipped `CHANGELOG.rst` in GitHub's `build/build` checkout, leaving the 1.6.0 changelog over 120 columns. Pin the release dependency and pre-commit hook to v2.2.1, with a package-specific cutoff timestamp so uv can install it before the seven-day window expires. Reformat the existing changelog to match docstrfmt's output.
1 parent 5711d25 commit 0ef5a40

5 files changed

Lines changed: 25 additions & 22 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repos:
3939
- mdformat-gfm>=1
4040
- mdformat-ruff>=0.1.3
4141
- repo: https://github.com/LilSpazJoekp/docstrfmt
42-
rev: a05381030e526dc863e2006d34824271d7681d08 # frozen: v2.2.0
42+
rev: c1813841673cdcd6cf602dde1edb78a5d5e45235 # frozen: v2.2.1
4343
hooks:
4444
- id: docstrfmt
4545
args: ["-l", "120"]

CHANGELOG.rst

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,39 @@
1212
:user:`gaborbernat` (:issue:`311`)
1313
- The "Unmet dependencies" error from ``--no-isolation`` builds now shows the wanted version, found version, and
1414
interpreter - by :user:`gaborbernat` (:issue:`504`)
15-
- Add ``--sdist-extract-dir`` to extract the intermediate sdist into a persistent directory, enabling compiler cache reuse
16-
across rebuilds - by :user:`gaborbernat` (:issue:`614`)
17-
- Add ``--env-dir`` to place the isolated build environment at a fixed path, enabling compiler cache reuse across builds -
18-
by :user:`gaborbernat` (:issue:`655`)
15+
- Add ``--sdist-extract-dir`` to extract the intermediate sdist into a persistent directory, enabling compiler cache
16+
reuse across rebuilds - by :user:`gaborbernat` (:issue:`614`)
17+
- Add ``--env-dir`` to place the isolated build environment at a fixed path, enabling compiler cache reuse across builds
18+
- by :user:`gaborbernat` (:issue:`655`)
1919
- Print a summary of resolved dependency versions (``name==version``) after installing them in isolated builds - by
2020
:user:`gaborbernat` (:issue:`959`)
21-
- On build failure, print a tip pointing to ``--env-dir`` and ``--sdist-extract-dir`` for debugging and link to the "Debug
22-
a failed build" how-to - reported by :user:`dimpase`, implemented by :user:`gaborbernat` (:issue:`966`)
21+
- On build failure, print a tip pointing to ``--env-dir`` and ``--sdist-extract-dir`` for debugging and link to the
22+
"Debug a failed build" how-to - reported by :user:`dimpase`, implemented by :user:`gaborbernat` (:issue:`966`)
2323

2424
**********
2525
Bugfixes
2626
**********
2727

2828
- Drain verbose subprocess output inline instead of using a ``ThreadPoolExecutor``, which silently swallowed logging
2929
errors - by :user:`henryiii` (:issue:`1098`)
30-
- Reject a file passed as ``--env-dir`` with a clear error instead of a raw ``FileExistsError`` - by :user:`henryiii` (:issue:`1100`)
30+
- Reject a file passed as ``--env-dir`` with a clear error instead of a raw ``FileExistsError`` - by :user:`henryiii`
31+
(:issue:`1100`)
3132
- Emit CLI warnings to stderr instead of stdout, so they no longer corrupt ``--metadata`` JSON output on stdout - by
3233
:user:`ymyzk` (:issue:`1111`)
33-
- Fix the Windows symlink support probe always returning ``False`` due to a stale object interpolated into the destination
34-
path - by :user:`henryiii` (:issue:`1118`)
34+
- Fix the Windows symlink support probe always returning ``False`` due to a stale object interpolated into the
35+
destination path - by :user:`henryiii` (:issue:`1118`)
3536
- Fix ``metadata_path``'s build-backend fallback returning a nonexistent dist-info path for wheels with a build tag - by
3637
:user:`henryiii` (:issue:`1119`)
37-
- Write pip/uv requirements and constraints files with ``\n`` instead of ``os.linesep``, avoiding doubled ``\r\r\n`` line
38-
endings on Windows - by :user:`henryiii` (:issue:`1120`)
38+
- Write pip/uv requirements and constraints files with ``\n`` instead of ``os.linesep``, avoiding doubled ``\r\r\n``
39+
line endings on Windows - by :user:`henryiii` (:issue:`1120`)
3940
- Batch of small robustness fixes: correct macOS release parsing for the minimum pip version, avoid sharing the mutable
4041
default build-system table between builders, keep the original error when isolated-environment setup fails early, and
4142
raise ``BuildException`` for an invalid wheel - by :user:`henryiii` (:issue:`1121`)
4243
- Decide color support independently for stdout and stderr instead of only checking ``stdout.isatty()``, so redirecting
4344
one stream no longer disables or leaks ANSI colors on the other - by :user:`henryiii` (:issue:`1123`)
4445
- Pass ``--dependency-constraints-txt`` files through to the installer unmodified instead of re-parsing them into a
45-
deduplicated set of lines, fixing a case where a hashed requirement (e.g. from ``pip-compile --generate-hashes``) could
46-
have its ``--hash`` continuation line separated from its requirement line and silently dropped, depending on the
46+
deduplicated set of lines, fixing a case where a hashed requirement (e.g. from ``pip-compile --generate-hashes``)
47+
could have its ``--hash`` continuation line separated from its requirement line and silently dropped, depending on the
4748
interpreter's hash seed - by :user:`manfred-kaiser` (:issue:`1140`)
4849

4950
**********
@@ -56,15 +57,17 @@
5657
Deprecations
5758
**************
5859

59-
- Deprecate :func:`build.util.project_wheel_metadata`; use ``python -m build --metadata`` instead - by :user:`gaborbernat` (:issue:`557`)
60-
- Warn on config settings without a value (e.g. ``-C--my-flag``); use ``-C--my-flag=`` instead for compatibility with pip
61-
- by :user:`gaborbernat` (:issue:`640`)
60+
- Deprecate :func:`build.util.project_wheel_metadata`; use ``python -m build --metadata`` instead - by
61+
:user:`gaborbernat` (:issue:`557`)
62+
- Warn on config settings without a value (e.g. ``-C--my-flag``); use ``-C--my-flag=`` instead for compatibility with
63+
pip - by :user:`gaborbernat` (:issue:`640`)
6264

6365
***************
6466
Miscellaneous
6567
***************
6668

67-
- :issue:`1058`, :issue:`1060`, :issue:`1062`, :issue:`1093`, :issue:`1099`, :issue:`1107`, :issue:`1113`, :issue:`1117`, :issue:`1122`, :issue:`1124`, :issue:`1128`, :issue:`1132`
69+
- :issue:`1058`, :issue:`1060`, :issue:`1062`, :issue:`1093`, :issue:`1099`, :issue:`1107`, :issue:`1113`,
70+
:issue:`1117`, :issue:`1122`, :issue:`1124`, :issue:`1128`, :issue:`1132`
6871

6972
####################
7073
1.5.0 (2026-04-30)

docs/changelog/1170.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Format generated release changelogs with docstrfmt 2.2.1 and reformat the 1.6.0 changelog - by :user:`gaborbernat`

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pyrefly = [
122122
{ include-group = "typing" },
123123
]
124124
release = [
125-
"docstrfmt == 2.2.0", # keep in sync with the docstrfmt rev in .pre-commit-config.yaml
125+
"docstrfmt == 2.2.1", # keep in sync with the docstrfmt rev in .pre-commit-config.yaml
126126
"gitpython >= 3.1.44",
127127
"packaging >= 25",
128128
"pre-commit >= 3.0",
@@ -147,6 +147,7 @@ exclude = [
147147

148148
[tool.uv]
149149
exclude-newer = "7 days"
150+
exclude-newer-package = { docstrfmt = "2026-08-28T18:00:18Z" }
150151

151152

152153
[tool.coverage]

tasks/release.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ def create_release_commit(repo: Repo, version: Version) -> Commit:
8181
update_version_file(version)
8282
print('build changelog from fragments with towncrier')
8383
check_call(['towncrier', 'build', '--yes', '--version', version.public], cwd=str(ROOT_SRC_DIR)) # noqa: S603
84-
# towncrier appends the issue reference past docstrfmt's width budget, so its raw output can run over the
85-
# limit; reflow it here with a pinned docstrfmt instead of trusting the release job's isolated hook env,
86-
# which passed over-long lines into 1.5.1 and left a changelog that failed pre-commit everywhere else.
84+
# towncrier can append issue references past docstrfmt's width budget.
8785
check_call(['docstrfmt', '--line-length', '120', 'CHANGELOG.rst'], cwd=str(ROOT_SRC_DIR))
8886
call(['pre-commit', 'run', '--all-files'], cwd=str(ROOT_SRC_DIR))
8987
call(['pre-commit', 'run', '--all-files'], cwd=str(ROOT_SRC_DIR))

0 commit comments

Comments
 (0)