Skip to content

REVIEW FIRST! Collect changelog entries from per-PR fragments - #985

Open
mcepl wants to merge 3 commits into
masterfrom
changelog-news-fragments
Open

mcepl wants to merge 3 commits into
masterfrom
changelog-news-fragments

Conversation

@mcepl

@mcepl mcepl commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Nearly every pull request conflicted on the top of CHANGELOG.md, because all of them appended to the same "Upcoming release" section. Following a much simplified version of CPython's blurb/NEWS.d workflow, each PR now adds a small Markdown file changelog.d/<issue>.md with its entry, so parallel PRs never touch the same file.

Contributors simply create changelog.d/<N>.md in any editor, or use the helper python bin/news.py <N> (standard library only, so it works on Windows as well as on Linux, the BSDs and macOS), which opens $VISUAL/$EDITOR/git's core.editor with a template encouraging longer, explanatory entries. python bin/news.py preview shows the pending release section, and python bin/news.py collect folds the fragments, sorted by number, into a new "# Release " section of CHANGELOG.md. For the release manager, a new portable top-level Makefile wraps it as make news N=123, make changelog-preview, make changelog and make release, the last of which also builds the documentation via docs/Makefile; that gains an explicit html rule, as its Sphinx-generated catch-all pattern rule is GNU make only. Neither make nor sh is needed to contribute.

The existing upcoming entry has been moved to a fragment, and the PR template, contributing and release-process docs updated.

Description

Please include a summary of the change and which issue is fixed.

Fixes #(issue)

Checklist (delete if not relevant):

  • I have added a changelog fragment
  • I have made corresponding changes to user documentation for new features
  • I have made corresponding changes to library documentation for API changes

@mcepl
mcepl requested a review from lieryan November 30, 2026 08:11
@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.46%. Comparing base (7821940) to head (143e1f8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #985   +/-   ##
=======================================
  Coverage   95.46%   95.46%           
=======================================
  Files         134      134           
  Lines       26946    26946           
=======================================
  Hits        25723    25723           
  Misses       1223     1223           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mcepl
mcepl force-pushed the changelog-news-fragments branch from a8fefe0 to 5cda563 Compare November 30, 2026 08:14
@mcepl mcepl changed the title Collect changelog entries from per-PR fragments REVIEW FIRST! Collect changelog entries from per-PR fragments Nov 30, 2026
@mcepl
mcepl requested a balanced review from Copilot November 30, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved issues drop a release-note entry, merge or overwrite changelog fragments, and execute Markdown backticks as shell commands instead of preserving literal text.

2 open issues
What changed in this PR

This PR replaces shared “Upcoming release” edits with per-PR changelog fragments, reducing merge conflicts while keeping CHANGELOG.md as the release history.

Changes:

  • Adds bin/news to create, preview, and collect fragments in numeric order.
  • Adds maintenance Make targets and an explicit documentation HTML target for BSD make compatibility.
  • Updates contributor instructions, the release process, and the PR checklist.
File Description
Makefile Adds changelog, documentation, and release targets.
docs/​release-process.rst Documents fragment collection during releases.
docs/​Makefile Adds an explicit html target for BSD make.
docs/​contributing.rst Directs contributors to create changelog fragments.
CHANGELOG.md Removes the existing upcoming-release section.
changelog.d/​README.md Explains fragment naming, formatting, and commands.
changelog.d/​985.md Adds a fragment announcing the new workflow.
bin/​news Implements fragment creation, preview, and collection.
.github/​PULL_REQUEST_TEMPLATE.md Replaces the changelog-edit checkbox with a fragment checkbox.

Review effort: Balanced

Comment thread CHANGELOG.md Resolved
Comment thread Makefile Resolved
@mcepl
mcepl added this pull request to stack #986 November 30, 2026 08:27
Nearly every pull request conflicted on the top of CHANGELOG.md,
because all of them appended to the same "Upcoming release"
section. Following a much simplified version of CPython's
blurb/NEWS.d workflow, each PR now adds a small Markdown file
changelog.d/<issue>.md with its entry, so parallel PRs never
touch the same file.

The new bin/news script (plain POSIX sh, so it works on Linux,
the BSDs and macOS) creates a fragment in $VISUAL/$EDITOR from a
template encouraging longer, explanatory entries (`bin/news 123`),
previews the pending release section (`bin/news preview`), and
folds the fragments, sorted by number, into a new "# Release
<version>" section of CHANGELOG.md (`bin/news collect`). A new
portable top-level Makefile wraps it as `make news N=123`,
`make changelog-preview`, `make changelog` and `make release`,
the last of which also builds the documentation via
docs/Makefile; that gains an explicit `html` rule, as its
Sphinx-generated catch-all pattern rule is GNU make only. The
news target passes N and TEXT to bin/news through the
environment ("$$N", "$$TEXT"), so Markdown backticks and quotes
in an entry reach the script literally instead of being
re-parsed by the shell.

The pending entry for the #223 regression tests, previously in
the "Upcoming release" section, has been moved to
changelog.d/223.md, and the PR template, contributing and
release-process docs updated.
@mcepl
mcepl force-pushed the changelog-news-fragments branch from d88420d to 18e7d47 Compare November 30, 2026 08:49
@mcepl
mcepl removed this pull request from stack #986 November 30, 2026 08:58
@mcepl

mcepl commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Note for contributors of open PRs: once this is merged, PRs which
still edit CHANGELOG.md directly will keep conflicting with
master. At the moment, these open PRs conflict only in
CHANGELOG.md:

#980, #979, #977, #970, #969, #967, #966, #964, #963, #962, #961, #959, #958, #930, #911, #910, #909, #904, #903, #902, #901, #900, #899, #897, #894, #893, #892, #890, #888, #887, #880, #878, #877, #876, #874, #866, #848

If you are the author of one of them (or of any other PR touching
CHANGELOG.md), please rebase your branch onto the current
master after this PR lands, drop your changes to
CHANGELOG.md, and put your entry into changelog.d/<N>.md
instead (<N> being the number of your PR or issue). For
example:

git remote add upstream https://github.com/python-rope/rope.git  # if not there yet
git fetch upstream
git rebase upstream/master
# whenever the rebase stops on a CHANGELOG.md conflict:
git checkout upstream/master -- CHANGELOG.md
git rebase --continue
# then add the entry and push:
python bin/changelog.py <N>   # or copy changelog.d/TEMPLATE.md to changelog.d/<N>.md
git add changelog.d/<N>.md
git commit -m "Add changelog entry"
git push --force-with-lease

The entry is one or more Markdown list items, with continuation
lines indented by two spaces:

- #<N> Short description of what changed and why, wrapped
  over several lines if needed. (@yourname)

See changelog.d/README.md for details. After this, your PR
should not run into changelog conflicts again. Thanks!

@lieryan

lieryan commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Thanks @mcepl.

I have been considering dropping the CHANGELOG.md updating requirement entirely and just having Github Release generate the changelog from PR titles and using that to populate CHANGELOG.md because of these merge conflict issues, but this actually seems like a better solution.

The original changelog workflow was setup back when we probably received just at most dozen or so PRs per year. It worked fine back then, but it hasn't really scaled to the current work pace

Probably the only thing I'd have done differently here is that I'd have written bin/news as a Python script, rather than sh script.

Requiring sh for basic contributions workflow like making changelog would increase the barrier of contributing for those coming from Windows.

Currently for first time contributors they'd need to setup their environment to have make installed only when they needed to render ./docs, because that's the workflow that was setup by Sphinx. But Sphinx also sets up make.bat workflow for Windows users, which helps ease that up. I would rather not extend the requirements to basically be on POSIX environment to make basic contributions.

For release manager, which currently is going to just be us at this point, requiring sh/make to collect changelogs and perform release management tasks is less of an issue, but the primary documented way for contributor to make changelog entries should not require make and sh.

As @lieryan pointed out in the review, requiring a POSIX shell
(and make) just to write a changelog entry would raise the
barrier for contributors on Windows, who so far only needed make
for building the documentation, and even there Sphinx provides
make.bat.

Replace the sh script with bin/news.py, which uses only the
standard library and keeps the same commands (add, preview,
collect). It looks for an editor in $VISUAL, $EDITOR and git's
core.editor, falling back to Notepad on Windows and vi elsewhere,
writes LF line endings everywhere, and numbers duplicate
fragments 1234-2.md, 1234-3.md, … instead of using a timestamp.

The contributor documentation now leads with simply creating
changelog.d/<N>.md in any editor, offers `python bin/news.py <N>`
as a helper, and mentions the make targets only as a shortcut;
these remain for the release manager and call the script via
$(PYTHON). The #985 fragment is expanded accordingly.
@mcepl

mcepl commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@lieryan Thanks, good point. I hadn't thought about Windows contributors at all. Fixed in d5a8021:

  • bin/news is now bin/news.py, using only the standard library. It keeps the same commands (python bin/news.py <N> [text], preview, collect). For the editor it tries $VISUAL, $EDITOR and git's core.editor, then falls back to Notepad on Windows and vi elsewhere. It always writes LF line endings.
  • changelog.d/README.md, docs/contributing.rst now start with simply creating changelog.d/<N>.md in any editor. python bin/news.py <N> comes next as an optional helper, and the make targets are mentioned only as a shortcut. Contributors no longer need make or sh.
  • The make targets stay for the release manager. They now call $(PYTHON) bin/news.py, with PYTHON ?= python3.

I've also changed the instructions in my comment above for authors of open PRs.

@lieryan lieryan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good overall. Just a couple comments and a bunch of nit picks.

The most important change I'm requesting here is just how this changelog process is to be documented, we should separate the docs intended for contributors and the maintainers. The general theme here is to avoid infodumping new contributors with information they don't need about our internal processes if all they want to do is just to make a simple contribution.

Since contributing.rst and changelog.d/README are essential reading for every contributors, they need to stay as a short read and cover only what contributors need to know so they don't get overwhelmed and TL;DR them.

Comment thread bin/news.py Outdated
PYPROJECT = ROOT / "pyproject.toml"

# The first line ends with a space, so that the cursor lands after it.
TEMPLATE = "- #{n} \n" + """

@lieryan lieryan Nov 30, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the template text in changelog.d/TEMPLATE.md or maybe docs/changelog-template.md?

As a separate file:

  • you have the option to manually copy the file
  • you get syntax highlighting when editing the template

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 143e1f8: the template is now changelog.d/TEMPLATE.md. bin/changelog.py opens it in the editor, and it can be copied by hand as well. The guidance in it is an HTML comment, which is stripped when the entries are collected.

Comment thread bin/news.py Outdated
def write_text(path, text):
# Keep LF line endings on Windows too.
with open(path, "w", encoding="utf-8", newline="\n") as f:
f.write(text)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.write_text() for consistency with read_text()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 143e1f8: write_text() now calls path.write_text(text, encoding="utf-8", newline="\n"). The newline parameter needs Python 3.10, which is our minimum anyway.

Comment thread bin/news.py Outdated
python bin/news.py collect fold the fragments into CHANGELOG.md

Only the standard library is used, so this works anywhere rope's
test suite does, including Windows.

@lieryan lieryan Nov 30, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the standard library is used, so this works anywhere rope's test suite does, including Windows.

This paragraph should be removed.

There's no good reason to single out mentioning Windows here. The whole project supports all 3 OSes, that's the presumed default throughout most of the project.

Also, the module docstring is shown to the user as built-in/usages help, it's not the right place to document implementation decisions like why news.py only uses stdlib.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the module docstring is shown to the user as built-in/usages help,

Ah, ok. Never mind that, just realised that the current implementation of usages() only prints the first paragraph, so this paragraph won't be shown when printing the built-in help.

That said, printing only the first paragraph means that the built in help doesn't show the command's syntax as those are in the second and third paragraphs. I think usages() should show those syntax help.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 143e1f8. With argparse the help now shows the syntax of all commands (see the reply on the argparse comment).

Comment thread changelog.d/README.md Outdated
Instead of editing `CHANGELOG.md` directly (which makes nearly
every pull request conflict with every other one), each pull
request adds a small file to this directory. The fragments are
merged into `CHANGELOG.md` when a new version is released.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right place to elaborate the design rationale for the changelog.d directory. If it's not something that's necessary for contributors to understand while they're making a contribution, it shouldn't be here. The changelog.d/README.md should be focused on being a usage instruction rather than a complete documentation of how things works.

People could pull the PR discussions or commit messages if they want to understand why things are the way they are. But if it's necessary to document it properly, the detailed design rationale should maybe be in a comment inside news.py script or maybe docs/ instead rather than here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, removed in 143e1f8. The README now only explains how to add an entry. The short rationale is a comment in bin/changelog.py.

Comment thread changelog.d/README.md Outdated
files (like this one) are ignored.

The content is one or more Markdown list items, in the same style
as the existing `CHANGELOG.md`. Please don't limit yourself to a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the same style as the existing CHANGELOG.md

This part of the sentence would not make sense to new contributors and once this workflow becomes established. Should just be removed or rephrased.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 143e1f8.

Comment thread docs/release-process.rst Outdated
into ``CHANGELOG.md`` (``git rm``-ing the fragments) and builds the
documentation; ``make changelog-preview`` shows the result in advance
(without ``make``: ``python bin/news.py collect`` and
``python bin/news.py preview``)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is just a checklist for me to go through when doing a release, it isn't the right place to go in detail what news.py script does.

Just document the command I can copy paste, and very optionally a very brief/one line description of what it does.

Also, collecting the CHANGELOG.md should be step 1 rather than here, because I use it to cross check against the tickets in the Milestone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 143e1f8: step 1 is now to bump the version and run python bin/changelog.py collect, so the milestone can be checked against CHANGELOG.md. The version has to be bumped first because the release heading is taken from pyproject.toml. The description of what the script does has been removed.

Comment thread CHANGELOG.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a short warning text here to warn people not to modify this file directly and to direct them to the right place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 143e1f8 as an HTML comment at the top. collect puts new releases below it, just above the first # Release heading.

Comment thread changelog.d/README.md Outdated

which opens your editor (`$VISUAL`, `$EDITOR` or git's
`core.editor`, falling back to Notepad on Windows and `vi`
elsewhere) with a template and saves the result as

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just briefly mention that it tries to find a default editor, and document how to override the automatic detection if it used the wrong one. Direct them to read the script if anyone's interested in how exactly it finds the default editor.

This file shouldn't be documenting the implementation details of news.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 143e1f8: the README now says only that the script picks an editor and that VISUAL or EDITOR overrides that choice. The details are in the script.

Comment thread changelog.d/README.md Outdated
Several related issues may be listed together, e.g.
`- #826, #940 Keep star imports …`.

## Helper script

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section for how to add an entry should document the convenience script first, and the manual method be the alternative version for those who don't want to or can't use the script for some reason.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 143e1f8: the script comes first and copying TEMPLATE.md by hand is the alternative.

Comment thread bin/changelog.py
except NewsError as err:
print(err, file=sys.stderr)
return 1
return 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use argparse here to get a more familiar/standard CLI interface and make it easier to display a built-in documentation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 143e1f8: the script uses argparse with add, preview and collect subcommands, and --help lists them. python bin/changelog.py 1234 still works as a shortcut for add 1234.

Ketankhunti added a commit to Ketankhunti/rope that referenced this pull request Nov 30, 2026
mcepl asked for this on python-rope#965 (2026-11-30): python-rope#985 replaces direct
CHANGELOG.md edits with per-PR fragments in changelog.d/, and the
PR base is now changelog-news-fragments. The CHANGELOG.md edit was
also the merge conflict against the new base.
Ketankhunti added a commit to Ketankhunti/rope that referenced this pull request Nov 30, 2026
mcepl asked for this on python-rope#965 (2026-11-30): python-rope#985 replaces direct
CHANGELOG.md edits with per-PR fragments in changelog.d/, and the
PR base is now changelog-news-fragments. The CHANGELOG.md edit was
also the merge conflict against the new base.
Address the review of the changelog workflow. The script is now
bin/changelog.py and everything uses "changelog" rather than a
mix of "news" and "fragment". It uses argparse for a standard,
short help, writes files with Path.write_text(), and reads its
template from changelog.d/TEMPLATE.md, which contributors can
also copy by hand and which is the only copy of the style guide.
Collecting strips the template's HTML comment and inserts the
new release above the first "# Release" heading, so that the new
warning header at the top of CHANGELOG.md stays in place.

The contributor documentation (docs/contributing.rst and
changelog.d/README.md) is cut down to what a contributor needs:
the script first, the manual alternative second, and the warning
against editing CHANGELOG.md last. The design rationale moved to
a comment in the script and implementation details (editor
detection, Windows) are no longer described. The release
checklist now collects the changelog as step 1, so that it can be
checked against the milestone.

The Makefile stays as a thin convenience wrapper. "make changelog"
is now an alias for the CHANGELOG.md file target, which depends
on the pending entries; as collecting removes them, any entry
left forces a rebuild regardless of timestamps.
@mcepl
mcepl requested a review from lieryan December 1, 2026 09:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants