ENH: Added `notes` command for spin by ganesh-k13 · Pull Request #25017 · numpy/numpy · GitHub
Skip to content

ENH: Added notes command for spin#25017

Merged
stefanv merged 5 commits into
numpy:mainfrom
ganesh-k13:bld_24080_notes
Nov 8, 2023
Merged

ENH: Added notes command for spin#25017
stefanv merged 5 commits into
numpy:mainfrom
ganesh-k13:bld_24080_notes

Conversation

@ganesh-k13

@ganesh-k13 ganesh-k13 commented Oct 28, 2023

Copy link
Copy Markdown
Member

Changes

  • Added a notes command for spin
  • Created main to support imports in test_all_newsfragments_used.py

Testing

Generate notes with version
~/os/numpy (bld_24080_notes) » spin notes --version-override 2.0                                                                                                                     ganesh@ganesh-MS-7B86
Generating release notes for NumPy 2.0
Loading template...
Finding news fragments...
Rendering news fragments...
Writing to newsfile...
Staging newsfile...
Removing news fragments...
Removing the following files:
/home/ganesh/os/numpy/doc/release/upcoming_changes/24532.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24946.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24877.improvement.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24775.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24858.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24634.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24540.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24854.deprecation.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24680.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24770.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24555.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24445.deprecation.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24945.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24922.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24555.improvement.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24818.deprecation.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24717.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24053.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24587.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24376.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24887.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24931.improvement.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24477.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24807.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24420.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/19355.new_feature.rst
Done!

Verifying consumption of all news fragments

Auto detect version
~/os/numpy (bld_24080_notes*) » spin notes                                                                                                                                  ganesh@ganesh-MS-7B86
Using inferred version 1.26.1
Generating release notes for NumPy 1.26.1
Loading template...
Finding news fragments...
Rendering news fragments...
Writing to newsfile...
Staging newsfile...
Removing news fragments...
Removing the following files:
/home/ganesh/os/numpy/doc/release/upcoming_changes/24532.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24946.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24877.improvement.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24775.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24858.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24634.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24540.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24854.deprecation.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24680.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24770.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24555.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24445.deprecation.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24945.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24922.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24555.improvement.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24818.deprecation.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24717.change.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24053.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24587.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24376.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24887.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24931.improvement.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24477.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24807.python_removal.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/24420.new_feature.rst
/home/ganesh/os/numpy/doc/release/upcoming_changes/19355.new_feature.rst
Done!

Verifying consumption of all news fragments

`towncrier` not found
~/os/numpy (bld_24080_notes*) » spin notes                                                                                                                                  ganesh@ganesh-MS-7B86
Using inferred version 1.26.1
Generating release notes for NumPy 1.26.1
Error: please install `towncrier` to use this command

Auto version detection failed
~/os/numpy (bld_24080_notes*) » spin notes                                                                                                                                  ganesh@ganesh-MS-7B86
Error: `pip show numpy` returned error: WARNING: Package(s) not found: numpy

Notes

Related: #24080

@ganesh-k13 ganesh-k13 self-assigned this Oct 28, 2023
@ganesh-k13 ganesh-k13 changed the title ENH: Added a notes command for spin ENH: Added notes command for spin Oct 28, 2023
@stefanv

stefanv commented Oct 30, 2023

Copy link
Copy Markdown
Contributor

@ganesh-k13

Copy link
Copy Markdown
Member Author

Ah ok, I can change that. I blindly copied from:

VERSION=$(pip show numpy | grep Version: | cut -d ' ' -f 2 | cut -c 1-5)

We can use the __version__, which might make more sense in a desktop as compared to what we have now which is good for CI.

@stefanv

stefanv commented Oct 31, 2023

Copy link
Copy Markdown
Contributor

Whatever you decide is good with me, I just wanted to point it out. Let me know when you're ready, and we'll get this in.

@ganesh-k13

Copy link
Copy Markdown
Member Author

@stefanv, I have made the change to use the installed NumPy version in the latest commit.

@stefanv stefanv 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.

The versioning is still a bit odd: do you ever want to pick up the installed NumPy to determine the version? I'd imagine the only thing that matters is whether the snippets match with the version of NumPy being released.

So, I'd have made the logic as follows:

  • Find the version in pyproject.toml (this config is already available to you via spin, btw)
  • You know that this version matches with the snippets about to be processed.
  • Use --version (or perhaps --version-override) to specify a custom version.

This way, you will never have release notes out of sync with the version of NumPy you're releasing.

@ganesh-k13

Copy link
Copy Markdown
Member Author

Thanks @stefanv, it's a lot cleaner this way.

@stefanv stefanv 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.

Some minor suggestions, but overall LGTM.

Comment thread .spin/cmds.py Outdated
Comment on lines +595 to +598
if not version_override:
version = util.get_config()['project']['version']
else:
version = version_override

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.

Suggested change
if not version_override:
version = util.get_config()['project']['version']
else:
version = version_override
version = version_override or util.get_config()['project.version']

@ganesh-k13 ganesh-k13 Nov 5, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Modified via b7045c9

Comment thread .spin/cmds.py Outdated
# towncrier build --version 2.1 --yes
cmd = ["towncrier", "build", "--version", version, "--yes"]
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8")

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.

Consider using _run as elsewhere in the file.

@ganesh-k13 ganesh-k13 Nov 5, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added via b7045c9

@stefanv

stefanv commented Nov 8, 2023

Copy link
Copy Markdown
Contributor

@stefanv stefanv merged commit a555e7d into numpy:main Nov 8, 2023
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.

3 participants