Skip to content

Group towncrier options in a towncrier table - #114

Merged
ericof merged 1 commit into
mainfrom
issue-112
Dec 3, 2026
Merged

ericof merged 1 commit into
mainfrom
issue-112

Conversation

@ericof

@ericof ericof commented Dec 3, 2026

Copy link
Copy Markdown
Member

Closes #112

In a specification 2 repository.toml, Towncrier options live in a towncrier table, shared by [repository.towncrier] and every [[package]]. Only 2.0.0a1 has shipped specification 2, so the flat keys are replaced outright.

Location Table settings default section default
[[package]] optional towncrier.toml, else pyproject.toml, in the package path (towncrier's own lookup order) package name
[repository.towncrier] present means on towncrier.toml "Project"
[[package]]
type = "python-plone"
name = "acme.core"
path = "backend"
changelog = "backend/CHANGELOG.md"
towncrier.section = "Backend"

Validation

At load time, with the package named in the message:

  • towncrier_settings and section on a package are rejected, and the message gives the new spelling.
  • enabled in [repository.towncrier] is rejected.
  • Unknown keys and empty values are errors in both places, so a typo cannot silently fall back to a default.

The schema now has one shared towncrier definition.

settings migrate

  • Writes towncrier.settings / towncrier.section as dotted keys and leaves out empty values.
  • Drops enabled.
  • Removes a [repository.towncrier] table that named no settings file. Specification 1 treated it as off, and keeping it would turn it on.

Specification 1 files are read as before.

pytest-jsonschema

The schema copy published by pytest-jsonschema 1.1.0 predates the table. The checks against it are strict xfails, and the test pinning how the two copies differ now covers both pending changes. A follow-up PR there will update the published schema.

Testing

  • 805 passed, 19 xfailed, and make lint is clean.
  • New tests/settings/test_towncrier.py (76 tests) and 16 migrate cases.
  • 15 new fixtures, also validated against the schema.
  • Six mutations (lookup order, runtime check, repository defaults, package section, two migrate rules) each make a test fail.

In a specification 2 repository.toml, the towncrier table is now shared
by [repository.towncrier] and every [[package]], with the keys settings
and section and different defaults per location.

In a package the table is optional: settings defaults to the
towncrier.toml or pyproject.toml found in the package path, in
towncrier's own lookup order, and section to the package name. The
flat towncrier_settings and section keys are rejected with a message
naming their replacement.

In the repository, the table being present turns the repository-level
news fragments on, with towncrier.toml and Project as defaults; enabled
is no longer accepted. Unknown keys and empty values are errors in both
places, so a typo cannot silently fall back to a default.

settings migrate writes the dotted form, drops enabled, and removes a
[repository.towncrier] table that named no settings file, since
specification 1 treated it as off. Specification 1 files are read as
before.

The schema copy published by pytest-jsonschema 1.1.0 predates the
table, so the checks against it are strict xfails until a release
carries the change.
@ericof
ericof requested a review from a team as a code owner December 3, 2026 13:33
@ericof ericof self-assigned this Dec 3, 2026
@ericof
ericof merged commit ab15dbf into main Dec 3, 2026
8 checks passed
@ericof
ericof deleted the issue-112 branch December 3, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Group a package's towncrier options in a towncrier table (spec 2)

1 participant