Skip to content

Remove the vocabulary modules in nameparser.config (#1007) - #1012

Merged
derek73 merged 1 commit into
masterfrom
feat/issue-1007-remove-vocab-modules
Nov 3, 2026
Merged

derek73 merged 1 commit into
masterfrom
feat/issue-1007-remove-vocab-modules

Conversation

@derek73

@derek73 derek73 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Closes #1007. Decided in chat 2026-11-02.

Merges before 2.8.1 is released, after #1010. 2.8.1 (#1011, on 2.x) carries the deprecation warning for this removal, and its messages link to the 3.0 migration guide this PR writes, so master gets it first (decided in chat); 3.0 is not released before 2.8.1.

What goes, what replaces it

These eight modules are removed:

  • nameparser.config.titles
  • nameparser.config.suffixes
  • nameparser.config.particles
  • nameparser.config.conjunctions
  • nameparser.config.bound_given_names
  • nameparser.config.given_names
  • nameparser.config.maiden_markers
  • nameparser.config.capitalization

Each was a row of NAME = _compiled.NAME assignments under a docstring that restated the rules. Those docstrings rendered as API reference and no test checked them.

The replacement is Lexicon.words(kind=..., **properties), merged in #1009. docs/migrate.rst gets a "Vocabulary constants → Lexicon.words" table with one call per 2.x constant. A set the compiler derives from a clash between readings is a comprehension over words and readings_of (TITLES_AMBIGUOUS is a title word with a given reading and no particle reading; TITLES is the rest). TITLE_PHRASES, compiled from attaches, has no spelling, and its row says so. CAPITALIZATION_EXCEPTIONS is dict(Lexicon.default().capitalization_exceptions).

nameparser.config keeps:

Code

  • Lexicon.default() reads CAPITALIZATION_EXCEPTIONS from _compiled.
  • tools/vocab/build.py's CONSTANTS roster is now a plain list of names, with no module column. _compiled.py's header says the sets are private, and it is rebuilt.
  • Tests that imported the constants now import them from _compiled.
  • test_contracts's frozen-constant sweep covers _compiled, with a floor of 24, and names _compiled.CAPITALIZATION_EXCEPTIONS as an exemption. Its quiet-import and star-import tests use surnames.
  • test_layering checks that each of the eight modules raises ModuleNotFoundError.

Docs

Tests and checks

  • test_migrate_s_words_call_reproduces_each_2x_constant evaluates each code row of migrate.rst's table against the compiled set it replaces (20 rows).
  • test_migrate_s_table_covers_every_compiled_constant checks that every 2.x constant has a row of its own, and checks the two-constant title row directly.
  • Full suite: 34901 passed. mypy, ruff, sphinx-build -b doctest docs (0 failures), the HTML build and python -m doctest README.rst all pass. snapshot.py matches the snapshot.
  • pytest -n0 -m serial (the benchmark guards): 42 passed, rerun at a normal load after a first run under load average 30–40 had failed on wall-clock timing.

Review

The independent review found no code defects. It found that TITLES had no row of its own (the shared row's call returns 816 words against TITLES' 786, and the coverage test passed on the name alone), a miscount in the decisions entry, two rows contradicting the removal, and stale AGENTS.md recipes; bae8c75 fixes them.

Rebased onto #1010

The branch is one commit rebased onto master after #1010 (fbcd08e). The seven conflicting files resolve so that both PRs hold:

  • nameparser.config's one public module is surnames.
  • The frozen-constant sweep exempts only _compiled.CAPITALIZATION_EXCEPTIONS.
  • migrate.rst's removals table keeps both new rows. Its "Finding the sites" covers regexes and the eight vocabulary modules together: 2.8.1 warns where a constant is read, and a bare import stays quiet.
  • The decisions file keeps both 2026-11-02 entries. The Remove the 1.x vocabulary names (PREFIXES, FIRST_NAME_TITLES, …) and their bridge #357 entry's header names both supersessions.
  • The release log keeps all three Breaking bullets.

Three AGENTS.md lines that merged without a conflict marker are fixed too: the regexes bullet, and the public-surface lines that named it.

On the rebased tree, pytest (34895 passed) and the serial benchmarks (42 passed) pass, as do mypy, ruff, build.py --check, snapshot.py, sphinx-build -W -b html, the doc doctests and the README doctest.

🤖 Generated with Claude Code

@derek73 derek73 added this to the 3.0 milestone Nov 3, 2026
@derek73 derek73 added the breaking-change Backwards-incompatible API change label Nov 3, 2026
@derek73 derek73 self-assigned this Nov 3, 2026
derek73 added a commit that referenced this pull request Nov 3, 2026
The table's only TITLES row named it with TITLES_AMBIGUOUS, whose words()
call returns 816 words where TITLES held 786, and the coverage test
passed on the name alone. Each is now a comprehension the test runs (a
title word with a given reading and no particle reading is ambiguous),
and the test asks every constant for a row of its own. The removal row
for 2.2's names no longer offers names this PR removes, the #357 release
bullet no longer says the word lists stay, the decisions entry drops its
miscount, and AGENTS.md's sub-set recipe and set list match the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derek73 added a commit that referenced this pull request Nov 3, 2026
…claim (#1012 review)

2.8.1 warns where code reads a constant of a removed vocabulary module,
never at a bare import, so migrate.rst's "Finding the sites" says to
upgrade to 2.8.1, lists the bare import among what passes and still
fails, and adds the eight modules to the search list. Three sites still
claimed one call per constant where TITLE_PHRASES has none and several
are comprehensions; the release bullet no longer pairs TITLES with a
call returning more words; AGENTS.md's layering example names a module
that exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nameparser.config.titles, suffixes, particles, conjunctions,
bound_given_names, given_names, maiden_markers and capitalization were
each a row of `NAME = _compiled.NAME` assignments under a docstring that
restated the rules, rendered as API reference and checked by nothing.
In 3.0 their sets are an implementation detail of configuring by
reading, so they go, and a caller lists a kind's words with
Lexicon.words(kind=...) (#1009). 2.8.1 warns where code reads one of
their constants.

nameparser.config keeps surnames (now with an __all__); Lexicon.default()
reads CAPITALIZATION_EXCEPTIONS from _compiled, and tools/vocab/build.py's
roster is a list of names. docs/migrate.rst gives a call or a
comprehension per 2.x constant, and a test runs each against the compiled
set it replaces and requires a row per constant; its "Finding the sites"
names the modules. customize.rst, usage.rst, modules.rst, the vocab
README, AGENTS.md's configuration section and mechanisms.md's recipe say
what replaces the modules. decisions/3-0-reevaluations records the
removal and the 2.8.1 that warns of it, superseding the #357 entry's
modules staying and the Lexicon-warning waiver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 force-pushed the feat/issue-1007-remove-vocab-modules branch from 410f2aa to 3f8f577 Compare November 3, 2026 04:17
@derek73
derek73 merged commit 05547d4 into master Nov 3, 2026
11 checks passed
@derek73
derek73 deleted the feat/issue-1007-remove-vocab-modules branch November 4, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Backwards-incompatible API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should from nameparser.config.titles import TITLES still work in 3.0, now that Lexicon.readings_of() answers what a word is?

1 participant