Repository navigation
Remove nameparser.config.regexes, which the parser has not read since 2.0 (#1008) - #1010
Merged
Merged
Conversation
… 2.0 (#1008) The REGEXES table configured only the v1 parser; since 2.0 it held a third copy of the patterns the pipeline and render hand-copy, and tests/v2/test_regex_sync.py pinned both copies to it as the source. That test now pins each hand copy to the pipeline's own pattern (_render._ROMAN to _vocab._ROMAN, _render._INITIAL to _vocab._INITIAL), and a pattern whose only other copy was the config table is declared with no source. Drops REGEXES from the freeze test's exempt mappings and the module from docs/modules.rst; adds a migrate.rst removals row, the customize freeze paragraph naming CAPITALIZATION_EXCEPTIONS alone, a release-log Breaking Changes bullet, and a decisions/3-0-reevaluations entry superseding the #357 entry's listing of regexes among the modules that stay. Provenance comments no longer point at the deleted file. Lands after 2.8.1, which warns on the import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The config pins were the only tripwire for _vocab._MARKS's U+1AB0-1AFF block and for _render._SPACES and _SPACE_BEFORE_COMMA's \s: narrowing any of them failed nothing once config's copies left. Behavior tests now catch each (a mark from every combining block keeps its abbreviation a title; any whitespace in a spec collapses, before a comma too), each run against its mutation. migrate.rst's "Finding the sites" says upgrade to 2.8.1, names the one import that warns and adds config.regexes to the search list; modules.rst drops "the compiled patterns in regexes". The decisions entry corrects which names left the roster and which lost their tests, and states the timing as 3.0 not releasing before 2.8.1. AGENTS.md's mypy gotcha gets a current example; _pieces' and test_contracts' comments are reworded and reflowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1008) 2.8.1 warns through the module's __getattr__, so `from nameparser.config.regexes import REGEXES` warns and a bare import of the module stays quiet. migrate.rst's removals intro and "Finding the sites" now say so, the bare import joining the list of code that passes the warnings check and still fails on 3.0, and the release bullet says "where a constant of it is read". Reflows modules.rst's paragraph, and adds a mechanisms.md field note: before deleting a pin, mutate each pattern it pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1008.
Note
3.0 is not released before 2.8.1, which warns of it. 2.8.1, built on the
2.xbranch, carries theDeprecationWarningthat announces this removal. It is raised where code reads a constant ofnameparser.config.regexes(from nameparser.config.regexes import REGEXESincluded); importing the module alone stays quiet. Every 3.0 removal warns in a released version first (decisions/3-0-reevaluations' standing discipline). This PR may merge to master before 2.8.1 ships, so the 3.0 migration guide that 2.8.1's warnings link to is live on readthedocs.What changes
nameparser/config/regexes.pyis deleted.from nameparser.config.regexes import REGEXESraisesImportError. Parsing is unchanged:snapshot.pyreports no moves.tests/v2/test_regex_sync.pypins each hand copy to the pipeline's pattern, not to the config table._SOURCESnow maps each copy to the(module, attribute)it must equal:_render._ROMAN→_vocab._ROMAN._render._INITIAL→_vocab._INITIAL. This is now a straight copy; before, it was compared to config'sinitialwith one?spliced back in._pieces/_assemble._PERIOD_ABBREV,_pieces/_assign._ROMANand_classify._INITIAL→ their_vocaboriginal.The test that the two initial copies agree, the dotted-initial test, the comma-set test and the completeness checks all stay.
Docs:
Policy(strip_bidi=...)/Policy(strip_emoji=...)). "Finding the sites" now says upgrade to 2.8.1 and that 2.8.1 warns where a constant ofregexesis read. It lists a bare import of the module among the code that passes the warnings check and still fails on 3.0, and addsconfig.regexesto the names to search for.CAPITALIZATION_EXCEPTIONSalone.nameparser.config.regexesin 3.0? The parser has not readREGEXESsince 2.0 #1008's three unguarded patterns).decisions/3-0-reevaluations: a 2026-11-02 Remove
nameparser.config.regexesin 3.0? The parser has not readREGEXESsince 2.0 #1008 entry superseding the 2026-10-28 Remove the 1.x vocabulary names (PREFIXES, FIRST_NAME_TITLES, …) and their bridge #357 entry's listing ofregexesamong thenameparser.configmodules that stay. The Standing line and the superseded entry's parenthetical are updated to match.Smaller changes:
test_contracts.pydropsregexes.REGEXESfrom the freeze test's exempt mappings._vocab.py,_render.py,_tokenize.pyand_pieces.pyno longer point at the deleted file.nameparser/AGENTS.md no longer point at it either, and the mypy gotcha gets a current example.Patterns whose only other copy was the config table
_render._SPACES,_SPACE_BEFORE_COMMA,_MACand_WORD,_vocab._PERIOD_NOT_AT_ENDand_tokenize._BIDIhave nothing left to sync with. They are declared in_SOURCESwithNone._vocab._MARKSand_tokenize._EMOJI_RANGESare not compiled patterns, so they were never in the roster, and their dedicated tests are removed._vocabpatronymic patterns keep their pin throughtest_locales.py::test_a_packs_marker_regexes_are_the_rules_its_patch_turns_on, which holds the RU and TR_AZ packs' copies to them.Three of these patterns had no other tripwire. Dropping U+1AB0-1AFF from
_MARKS, or narrowing_SPACESor_SPACE_BEFORE_COMMAto a literal space, passed the whole suite. Behavior tests now catch each one:test_a_mark_from_each_combining_block_stays_in_its_wordin test_parser.py: a mark from each of the five combining blocks keepsDr. inz◌. Janez Novak's abbreviation a title.test_collapse_reads_any_whitespace_as_a_spacein test_render.py: a tab, no-break space or ideographic space in a spec collapses, before a comma too.Verification
test_initial_copies_agree.uv run pytest -q(34,784 passed),uv run pytest -q -n0 -m serial(42 passed),uv run mypy,uv run ruff check,sphinx-build -b doctest docs(0 failures) and-W -b html,python -m doctest README.rst, andtools/differential/snapshot.py("matches the snapshot").nameparser/change since the last full pass is a comment.🤖 Generated with Claude Code