Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

finalize: KeyError when a news fragment's id contains a dot

Open Beginner friendly
#34 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
release

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jaraco/jaraco.develop

All issues in jaraco/jaraco.develop

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.