8000 MAINT: ensure towncrier can be run >1x, and is included in `spin docs` by rgommers · Pull Request #25933 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: ensure towncrier can be run >1x, and is included in spin docs #25933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Thumbs.db
#############################
doc/source/savefig/
doc/source/**/generated/
doc/source/release/notes-towncrier.rst

# Things specific to this project #
###################################
Expand Down
9 changes: 9 additions & 0 deletions .spin/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ def docs(ctx, sphinx_target, clean, first_build, jobs):

"""
meson.docs.ignore_unknown_options = True

# Run towncrier without staging anything for commit. This is the way to get
# release notes snippets included in a local doc build.
cmd = ['towncrier', 'build', '--version', '2.x.y', '--keep', '--draft']
p = subprocess.run(cmd, check=True, capture_output=True, text=True)
outfile = curdir.parent / 'doc' / 'source' / 'release' / 'notes-towncrier.rst'
with open(outfile, 'w') as f:
f.write(p.stdout)

ctx.forward(meson.docs)


Expand Down
10 changes: 6 additions & 4 deletions doc/RELEASE_WALKTHROUGH.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ needed information.
Finish the release notes
------------------------

If this is the first release in a series the release note is generated, see
the release note in ``doc/release/upcoming_changes/README.rst`` to see how to
do this. Generating the release notes will also delete all the news
fragment files in ``doc/release/upcoming_changes/``.
If there are any release notes snippets in ``doc/release/upcoming_changes/``,
run ``spin docs`` to build the docs, incorporate the contents of the generated
``doc/source/release/notes-towncrier.rst`` file into the release notes file
(e.g., ``doc/source/release/2.3.4-notes.rst``), and delete the now-processed
snippets in ``doc/release/upcoming_changes/``. This is safe to do multiple
times during a release cycle.

The generated release note will always need some fixups, the introduction will
need to be written, and significant changes should be called out. For patch
Expand Down
7 changes: 4 additions & 3 deletions doc/release/upcoming_changes/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ and double-backticks for code.
If you are unsure what pull request type to use, don't hesitate to ask in your
PR.

You can install ``towncrier`` and run ``towncrier build --draft --version 1.18``
if you want to get a preview of how your change will look in the final release
notes.
``towncrier`` is required to build the docs; it will be automatically run when
you build the docs locally with ``spin docs``. You can also run ``towncrier
build --draft --version 1.18`` if you want to get a preview of how your change
will look in the final release notes.

.. note::

Expand Down
8 changes: 1 addition & 7 deletions doc/release/upcoming_changes/template.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{% set title = "NumPy {} Release Notes".format(versiondata.version) %}
{{ "=" * title|length }}
{{ title }}
{{ "=" * title|length }}

{% for section, _ in sections.items() %}
{% set underline = underlines[0] %}{% if section %}{{ section }}
{{ underline * section|length }}{% set underline = underlines[1] %}
Expand Down Expand Up @@ -32,8 +27,7 @@ No significant changes.
{% endif %}
{% endfor %}
{% else %}
No significant changes.

(no release note snippets found)

{% endif %}
{% endfor %}
8 changes: 8 additions & 0 deletions doc/source/release/2.0.0-notes.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. currentmodule:: numpy

=========================
NumPy 2.0.0 Release Notes
=========================
Expand Down Expand Up @@ -1304,3 +1306,9 @@ You can use ``np.logical_or.reduce`` and ``np.logical_and.reduce``
to achieve the previous behavior.

(`gh-25712 <https://github.com/numpy/numpy/pull/25712>`__)



**Content from release note snippets in doc/release/upcoming_changes:**

.. include:: notes-towncrier.rst
40 changes: 8 additions & 32 deletions doc/source/release/template.rst
Original file line number Diff line number Diff line change
@@ -1,45 +1,21 @@
:orphan:

.. currentmodule:: numpy

==========================
NumPy 1.xx.x Release Notes
NumPy 2.xx.x Release Notes
==========================


Highlights
==========


New functions
=============


Deprecations
============


Future Changes
==============


Expired deprecations
====================


Compatibility notes
===================


C API changes
=============


New Features
============
*We'll choose highlights for this release near the end of the release cycle.*
Copy link
Member

Choose a reason for hiding this comment

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

We actually have a highlights section also in the release notes fragments which I think makes sense to not forget a highlight. OTOH, I am not sure we ever actually used it so this is fine also.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I think it's easier to determine at the end. It's a bit weird to add a note to one's own PR that the thing you're working on right now will be a highlight of the next release:)

Copy link
Member

Choose a reason for hiding this comment

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

Sure, you certainly have to audit it at the end.



Improvements
============
.. if release snippets have been incorporated already, uncomment the follow
line (leave the `.. include:: directive)

.. **Content from release note snippets in doc/release/upcoming_changes:**

Changes
=======
.. include:: notes-towncrier.rst
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ tracker = "https://github.com/numpy/numpy/issues"
"release notes" = "https://numpy.org/doc/stable/release"

[tool.towncrier]
# Do no set this since it is hard to import numpy inside the source directory
# the name is hardcoded. Use "--version 1.18.0" to set the version
single_file = false
filename = "doc/source/release/{version}-notes.rst"
filename = "doc/source/release/notes-towncrier.rst"
directory = "doc/release/upcoming_changes/"
issue_format = "`gh-{issue} <https://github.com/numpy/numpy/pull/{issue}>`__"
template = "doc/release/upcoming_changes/template.rst"
Expand Down
0