python-trio / trio

Trio – a friendly Python library for async concurrency and I/O
https://trio.readthedocs.io
Other
6.19k stars 341 forks source link

Make it easier to check the formatting of a newsfragment locally #3084

Open jakkdl opened 1 month ago

jakkdl commented 1 month ago

Currently if you want to check the validity of any newsfragment locally you need to do something like

export READTHEDOCS=1
cd docs
make html

but then towncrier will attempt to remove your newsfragments as well as update changelog.rst, which means you need to afterwards restore/unstage the changes to those files.

It would be great to have an invocation of a shell script/tox/hatch/make target/etc that checked the formatting of the fragments without messing up local files.

TeamSpen210 commented 1 month ago

Hmm, currently towncrier only runs if READTHEDOCS is set. What we could do instead is use --keep so it doesn't remove the newsfragments - we only really want that when committing a release. Have the sphinx conf.py first read in the changelog file, run towncrier, then revert the file after the build finished.

jakkdl commented 1 month ago

Reopening in case we want to change the implementation, see discussion in the linked PR.