Skip to content

Make nameparser.config.surnames private as config/_ko_surnames.py - #1077

Merged
derek73 merged 4 commits into
masterfrom
fix/3-0-private-ko-surnames
Nov 5, 2026
Merged

derek73 merged 4 commits into
masterfrom
fix/3-0-private-ko-surnames

Conversation

@derek73

@derek73 derek73 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

3.0 renames nameparser/config/surnames.py to nameparser/config/_ko_surnames.py (git mv, keeping KOREAN_SURNAMES). After this, nameparser.config has no public module, and the public import surface is nameparser and nameparser.locales. The words stay public as Lexicon.default().surnames, a field 4i-b kept public. #1076 warns of the move in 2.8.2.

from nameparser.config.surnames import KOREAN_SURNAMES raises ModuleNotFoundError. 2.1.0 through 2.8.2 imported it.

Why config/ and why _ko_.

  • The default lexicon reads the list, and _lexicon may not import locales/, the layer above it. The lists only a pack reads (locales/_es_given_names.py, _es_ar_given_names.py) stay beside their packs.
  • _ko_ follows the BCP 47 tag naming of vocab/ko.toml.

Code and tests

  • _lexicon.py imports the new module.
  • config/__init__.py and _invariants.py: docstrings updated.
  • tests/v2/test_layering.py: the module joins the gone-modules list, and a new test refuses any public module in nameparser/config/.
  • tests/v2/test_contracts.py: the frozen-constant sweep and the guarded-module roster read the private module. The quiet-import row now reads Lexicon.default().surnames. The star-import test of the public module is dropped, since no public module is left.
  • docs/migrate.rst's constant table gains a KOREAN_SURNAMES → d.surnames row. test_lexicon.py's table test now runs that row against the list too.

Docs

  • Every line saying the module "stays" now names the replacement: customize.rst, migrate.rst (two places, plus the row), locales.rst, usage.rst, and modules.rst (automodule dropped).
  • release_log.rst: a 3.0 Remove bullet citing the 2.8.2 warning. The unreleased 3.0 vocabulary-modules bullet drops its "stays".
  • Root AGENTS.md: the import surface, the vocabulary list and the layering line.
  • nameparser/vocab/README.md: the line that also said the packs "move here in phase 3", which phase 3 did, is rewritten.
  • New dated decisions entry in decisions/3-0-reevaluations. It supersedes the "stays" part of the 2026-11-02 Should from nameparser.config.titles import TITLES still work in 3.0, now that Lexicon.readings_of() answers what a word is? #1007 entry, and its Standing line is updated.

Checks: the suite (3.11 and 3.15), mypy, ruff, sphinx-build -b doctest and -b html, and python -m doctest README.rst all pass.

Follow-up: master's release log should gain the 2.8.2 entry once 2.8.2 ships, as 2.8.1's did.

🤖 Generated with Claude Code

The Korean census list moves with git mv to nameparser/config/_ko_surnames.py,
keeping KOREAN_SURNAMES, so nameparser.config holds no public module and the
public import surface is nameparser and nameparser.locales. The words stay
public as Lexicon.default().surnames; 2.8.2 warns of the move (#1076). The
list stays in config/ because the default lexicon reads it and _lexicon may
not import locales/; _ko_ follows vocab/ko.toml's tag.

test_layering refuses a public module in nameparser/config/, and migrate's
constant table gains a KOREAN_SURNAMES row that test_lexicon runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 3.0 milestone Nov 5, 2026
@derek73 derek73 added enhancement breaking-change Backwards-incompatible API change labels Nov 5, 2026
@derek73 derek73 self-assigned this Nov 5, 2026
derek73 and others added 3 commits November 4, 2026 23:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…decision is

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 merged commit 4ca9978 into master Nov 5, 2026
13 checks passed
@derek73
derek73 deleted the fix/3-0-private-ko-surnames branch November 5, 2026 07:50
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 enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant