finalize: KeyError when a news fragment's id contains a dot
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 82/100
Research direction
The traceback points to _release_bump in jaraco/develop/towncrier.py, where the fragment filename is split and the type is looked up in _release_bumps. Read that function and its callers, then run tox -e finalize with a fragment named +drop-python-3.10.feature.rst. Done when finalize handles the dotted id using the feature type without raising KeyError.
Written by the indexing model from the issue text.
Description
towncrier._release_bump parses a fragment filename from the left, so a dot anywhere in the id portion shifts the type field and raises KeyError.
Reproducer
A fragment named +drop-python-3.10.feature.rst (dropping support for an EOL Python, the version number written naturally):
$ tox -e finalize
...
File ".../jaraco/develop/towncrier.py", line 27, in _release_bump
return _release_bumps[type_]
KeyError: '10'
Because:
>>> '+drop-python-3.10.feature.rst'.split('.', 2)
['+drop-python-3', '10', 'feature.rst']
Notably, towncrier itself is fine with the name
towncrier build --draft renders the fragment under Features exactly as intended — it parses the type from the right. So the name is only invalid by jaraco.develop's stricter reading, which makes the failure surprising: the changelog builds, but the release can't be cut.
Suggested fix
rsplit matches towncrier's own interpretation and is a one-character change:
>>> '+drop-python-3.10.feature.rst'.rsplit('.', 2)
['+drop-python-3.10', 'feature', 'rst']
Two adjacent observations
_release_bumps is built as collections.defaultdict(feature='minor', ...). Those are all keyword arguments, so default_factory is None and the mapping raises KeyError like a plain dict. If the defaultdict was meant to supply a fallback bump for unrecognized types, it isn't doing so.
check_changes() wouldn't have caught this either — it tests f".{key}" in file.suffixes, and .feature is among ['.10', '.feature', '.rst'], so the name passes. It also isn't called from finalize(), so nothing validates names before release_kind() runs.
Seen with jaraco.develop 9.0.0, towncrier 26.9.0.
- Dominant language
- Python
- Stars
- 7
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jaraco/jaraco.develop
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
jaraco/jaraco.develop#27 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
jaraco/jaraco.develop#22 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
jaraco/jaraco.develop#13 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
jaraco/jaraco.develop#8 · 4 comments ·
All issues in jaraco/jaraco.develop
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
foxglove/mcap#1907 · 1 comment ·
Maintainers usually reply within 1 day
-
namespace operations
Difficulty 1/5 Under an hour Newbie friendliness 72/100
EclipseFdn/open-vsx.org#14623 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
developmentseed/titiler-cmr#261 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
andrewyng/openworker#774 ·
Maintainers usually reply within 1 day
-
aggfuncOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
worldbank/blackmarblepy#160 ·