Skip to content

Allow the GH issue + Section as --flags and take news via stdin #45

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ jobs:
with:
python-version: "3.x"
- uses: tox-dev/action-pre-commit-uv@v1
- uses: astral-sh/ruff-action@v3
with:
args: check
src: "."
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,9 @@ ENV/

# hatch-vcs
src/*/_version.py

*.bak
*.swp

CLAUDE.local.md
.claude/*
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.1.0 (unreleased)

* Add automation support to `blurb add` command:
* New `--issue` option to specify GitHub issue number (supports URLs and various formats)
* New `--section` option to specify NEWS section (with smart case-insensitive matching)
* New `--rst-on-stdin` option to read entry content from stdin
* Useful for CI systems and automated tools
* Uses `cyclopts` for command line parsing instead of rolling our own to reduce our code size, this changes the help format and brings in a dependency.

## 2.0.0

* Move 'blurb test' subcommand into test suite by @hugovk in https://github.com/python/blurb/pull/37
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ It opens a text editor on a template; you edit the
file, save, and exit. **blurb** then stores the file
in the correct place, and stages it in Git for you.

#### Automation support

For automated tools and CI systems, `blurb add` supports non-interactive operation:

```bash
# Add a blurb entry from stdin
echo 'Added beans to the :mod:`spam` module.' | blurb add \
--issue 123456 \
--section Library \
--rst-on-stdin
```

When using `--rst-on-stdin`, both `--issue` and `--section` are required.

The `--issue` parameter accepts various formats:
- Issue number: `--issue 12345`
- With gh- prefix: `--issue gh-12345`
- GitHub URL: `--issue https://github.com/python/cpython/issues/12345`

The `--section` parameter supports smart matching:
- Case insensitive: `--section library` or `--section LIBRARY`
- Partial matching: `--section lib` (matches "Library")
- Common aliases: `--section api` (matches "C API"), `--section builtin` (matches "Core and Builtins")

The template for the `blurb add` message looks like this:

#
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ classifiers = [
dynamic = [
"version",
]
dependencies = [
"cyclopts>=3",
]
optional-dependencies.tests = [
"pyfakefs",
"pytest",
Expand Down
2 changes: 1 addition & 1 deletion src/blurb/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from ._version import __version__
from ._version import __version__ as __version__
Loading
Loading