python / blurb

Command-line tool to manage CPython Misc/NEWS.d entries
Other
10 stars 6 forks source link

Add `--gh` and `--section` flags to "blurb add" #15

Closed hugovk closed 2 months ago

hugovk commented 3 months ago

Fixes https://github.com/python/blurb/issues/6.

Updated version of https://github.com/python/core-workflow/pull/312 but with --gh instead of --bpo.

Examples

Success cases

blurb add opens the usual empty template

#
# Please enter the relevant GitHub issue number here:
#
.. gh-issue: 

#
# Uncomment one of these "section:" lines to specify which section
# this entry should go in in Misc/NEWS.d.
#
#.. section: Security
#.. section: Core and Builtins
#.. section: Library
#.. section: Documentation
#.. section: Tests
#.. section: Build
#.. section: Windows
#.. section: macOS
#.. section: IDLE
#.. section: Tools/Demos
#.. section: C API

# Write your Misc/NEWS.d entry below.  It should be a simple ReST paragraph.
# Don't start with "- Issue #<n>: " or "- gh-issue-<n>: " or that sort of stuff.
###########################################################################

blurb add --gh 123456 opens the template with gh-issue filled in

#
# Please enter the relevant GitHub issue number here:
#
.. gh-issue: 123456

#
# Uncomment one of these "section:" lines to specify which section
# this entry should go in in Misc/NEWS.d.
#
#.. section: Security
#.. section: Core and Builtins
#.. section: Library
#.. section: Documentation
#.. section: Tests
#.. section: Build
#.. section: Windows
#.. section: macOS
#.. section: IDLE
#.. section: Tools/Demos
#.. section: C API

# Write your Misc/NEWS.d entry below.  It should be a simple ReST paragraph.
# Don't start with "- Issue #<n>: " or "- gh-issue-<n>: " or that sort of stuff.
###########################################################################

blurb add --section Security adds an uncommented section

#
# Please enter the relevant GitHub issue number here:
#
.. gh-issue: 

#
# Uncomment one of these "section:" lines to specify which section
# this entry should go in in Misc/NEWS.d.
#
#.. section: Security
#.. section: Core and Builtins
#.. section: Library
#.. section: Documentation
#.. section: Tests
#.. section: Build
#.. section: Windows
#.. section: macOS
#.. section: IDLE
#.. section: Tools/Demos
#.. section: C API
.. section: Security

# Write your Misc/NEWS.d entry below.  It should be a simple ReST paragraph.
# Don't start with "- Issue #<n>: " or "- gh-issue-<n>: " or that sort of stuff.
###########################################################################

blurb add --gh 123456 --section Security adds both

#
# Please enter the relevant GitHub issue number here:
#
.. gh-issue: 123456

#
# Uncomment one of these "section:" lines to specify which section
# this entry should go in in Misc/NEWS.d.
#
#.. section: Security
#.. section: Core and Builtins
#.. section: Library
#.. section: Documentation
#.. section: Tests
#.. section: Build
#.. section: Windows
#.. section: macOS
#.. section: IDLE
#.. section: Tools/Demos
#.. section: C API
.. section: Security

# Write your Misc/NEWS.d entry below.  It should be a simple ReST paragraph.
# Don't start with "- Issue #<n>: " or "- gh-issue-<n>: " or that sort of stuff.
###########################################################################

Error cases

❯ blurb add --gh Security
Error: blurb add --gh argument Security is not a valid integer!

❯ blurb add --section 123456
Error: blurb add --section argument '123456' is not a valid section!  Use one of:
Security
Core and Builtins
Library
Documentation
Tests
Build
Windows
macOS
IDLE
Tools/Demos
C API

❯ blurb add --gh Security --section 123456
Error: blurb add --gh argument Security is not a valid integer!
hugovk commented 3 months ago

pyfakefs doesn't yet support Python 3.13 (https://github.com/pytest-dev/pyfakefs/issues/1017), let's temporarily remove it from the CI.

picnixz commented 3 months ago

Aaaah I was writing it as well! I have an alternative where you can add something like blurb add -i 12345 -s 2 instead of writing the section name. ~But I did not have your alternative with --gh and --section~.

@hugovk I have an alternative with tests and a bit more checks, could I also post it?

hugovk commented 3 months ago

@picnixz Yes, please do :)

hugovk commented 2 months ago

Closing in favour of https://github.com/python/blurb/pull/16.