Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

クローズ 初心者向け
#34 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
release

調査の方向性

traceback は jaraco/develop/towncrier.py の _release_bump を指しています。ここでは、フラグメントのファイル名が分割され、型が _release_bumps で検索されます。この関数とその呼び出し元を読み、+drop-python-3.10.feature.rst という名前のフラグメントを使って tox -e finalize を実行してください。finalize が feature 型を使ってドットを含む ID を処理し、KeyError を発生させなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
7
フォーク
5
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

jaraco/jaraco.develop のほかの issue

jaraco/jaraco.develop の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。