Skip to content

Build release notes from MyST Markdown - #32768

Draft
stefanv wants to merge 2 commits into
numpy:mainfrom
stefanv:towncrier-md
Draft

stefanv wants to merge 2 commits into
numpy:mainfrom
stefanv:towncrier-md

Conversation

@stefanv

@stefanv stefanv commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

This is a proof-of-concept PR to show how markdown release notes would look using the myst_parser plugin for Sphinx. There are two commits, which I recommend we look at separately: the first is for updating the Sphinx machinery (that one we can cherry-pick in the future), and the second to show the syntax changes to the release note snippets themselves (we wouldn't merge this, since we can simply switch to the new machinery after a next release).

myst_parser is pretty forgiving, in the sense that if a role is not used by myst, it passes it through as a Sphinx directive. That's why so few changes are needed to the notes, and why maintainers won't need to memorize a new syntax. If, in some future, we switch over to https://mystmd.org, the changes will be more extensive, since that engine only supports myst markdown.

I made this PR after a discussion on the community call, to better inform a decision; it is simply a demonstration, and there is no NEED to switch now.

See #23805 for background.

AI Disclosure

The changes were generated using claude-code:claude-opus-5.
The PR description is written by me.

@jorenham

Copy link
Copy Markdown
Member

Code was generated using claude-code:claude-opus-5

FYI: opus 5.5 is out, and in my experience quite a bit better :)

@jorenham

Copy link
Copy Markdown
Member

Nice PR number, BTW ($2^{15}$) 😋

@stefanv

stefanv commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @jorenham, I've had a look at the new model, and you are right. I will review these changes with 5.5 and update the commits.

@stefanv

stefanv commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Actually, this is quite nice: we no longer have to use pandoc to convert snippets! Thought @ngoldbaum would appreciate that part.

@@ -0,0 +1 @@

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.

What happened 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.

That file is empty on main too 🤷

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.

Can ask @ngoldbaum for b245332

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.

I probably forgot to git rm it and no one noticed.

Comment thread doc/release/upcoming_changes/README.md Outdated
Switch the towncrier template, output file and release note skeleton to
Markdown, and enable myst_parser in the Sphinx build.

Single backticks are literal text in Markdown, so cross-references now need
an explicit role such as {func}`numpy.sum`.  Unlike previously, a role with
a target that does not exist now fails the CI doc build.  A
missing-reference handler resolves the `np.` alias, so {func}`np.sum` also
links.

Exclude notes-towncrier.md from the Sphinx sources: it is pulled in through
an {include} from the release notes themselves.

tools/write_release.py converts the notes to GitHub Markdown, so pandoc is
no longer required to convert rst to md.  The GitHub release no longer
attaches the notes as a file, since those appear in the release
description.

Assisted-by: claude-code:claude-opus-5-5
Headings now are `###`, literals use single backticks,
cross-references get a role that depends on the type of object it
refers to (module, function, etc.).

Assisted-by: claude-code:claude-opus-5
@@ -0,0 +1,7 @@
### {func}`numpy.common_type` now raises a clear error for non-array input

Passing a dtype or scalar type to {func}`numpy.common_type`, such 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.

This is what I was talking about with new syntax. Even if it is annoying for people used to markdown, it’s really nice that single backticks in rst handle this automatically

@stefanv stefanv Sep 23, 2026 •

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.

Would you prefer a generic role, such as

{np}``common_type``

?

Func, mod, class feel like easy to remember distinctions, but we can make tweaks like this as long as it remains myst markdown.

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.

I don’t think that’s much better 🤷‍♂️

Anyway it’s a tradeoff and it’s not a huge deal to me personally if we do change it.

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.

I like it; it's like type annotations 🥳

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.

really nice that single backticks in rst handle this automatically

I always have to remove all the links and turn them into code because they cannot be resolved in the posted notes. I would be happier if they were never used in the snippets.

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.

I would be happier if they were never used in the snippets.

That's too bad. I wonder if there's a better way to make sure the nice links show up in the github release notes.

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.

I imagine we can turn them into absolute docs links. Versioning won't be straightforward, though, but if we made a compromise like "always point to the dev docs for that function" it'd be easier.

@charris

charris commented Sep 26, 2026

Copy link
Copy Markdown
Member

I am thinking of changing the changelogs to markdown as well. They are not part of the published documentation, so that makes translation almost trivial.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants