Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
a8fefe0 to
5cda563
Compare
There was a problem hiding this comment.
🟡 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/newsto 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
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.
d88420d to
18e7d47
Compare
|
Note for contributors of open PRs: once this is merged, PRs which #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 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-leaseThe entry is one or more Markdown list items, with continuation - #<N> Short description of what changed and why, wrapped
over several lines if needed. (@yourname)See |
|
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 Requiring Currently for first time contributors they'd need to setup their environment to have 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 |
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.
|
@lieryan Thanks, good point. I hadn't thought about Windows contributors at all. Fixed in d5a8021:
I've also changed the instructions in my comment above for authors of open PRs. |
lieryan
left a comment
There was a problem hiding this comment.
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.
| PYPROJECT = ROOT / "pyproject.toml" | ||
|
|
||
| # The first line ends with a space, so that the cursor lands after it. | ||
| TEMPLATE = "- #{n} \n" + """ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
path.write_text() for consistency with read_text()?
There was a problem hiding this comment.
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.
| 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Removed in 143e1f8. With argparse the help now shows the syntax of all commands (see the reply on the argparse comment).
| 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Agreed, removed in 143e1f8. The README now only explains how to add an entry. The short rationale is a comment in bin/changelog.py.
| 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 |
There was a problem hiding this comment.
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.
| 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``) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Added in 143e1f8 as an HTML comment at the top. collect puts new releases below it, just above the first # Release heading.
|
|
||
| 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| Several related issues may be listed together, e.g. | ||
| `- #826, #940 Keep star imports …`. | ||
|
|
||
| ## Helper script |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Done in 143e1f8: the script comes first and copying TEMPLATE.md by hand is the alternative.
| except NewsError as err: | ||
| print(err, file=sys.stderr) | ||
| return 1 | ||
| return 0 |
There was a problem hiding this comment.
Maybe use argparse here to get a more familiar/standard CLI interface and make it easier to display a built-in documentation?
There was a problem hiding this comment.
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.
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.
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.

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>.mdwith its entry, so parallel PRs never touch the same file.Contributors simply create
changelog.d/<N>.mdin any editor, or use the helperpython 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'score.editorwith a template encouraging longer, explanatory entries.python bin/news.py previewshows the pending release section, andpython bin/news.py collectfolds 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 asmake news N=123,make changelog-preview,make changelogandmake release, the last of which also builds the documentation via docs/Makefile; that gains an explicithtmlrule, as its Sphinx-generated catch-all pattern rule is GNU make only. Neithermakenorshis 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):