Post-rc1 API polish: StrEnum Role, Parser conveniences, dead-vocabulary repair#290
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every Lexicon vocabulary field except given_name_titles is matched one
word at a time, so a multi-word entry can never match -- the library
itself shipped eight such dead entries for years (repaired in the
previous commit). Per the inert-not-harmful convention a raise is
forbidden (see the given_name_titles Gotcha in AGENTS.md); warn
instead, from _normset (all per-word vocab fields) and _normpairs
(capitalization_exceptions keys), through every entry path --
constructor, add(), union, unpickle re-validation, and the v1 shim's
snapshot.
Also fixes tests/v2/test_properties.py's shared _VOCAB hypothesis pool,
which drew a multi-word phrase ("grand duke") into every Lexicon field
even though its own comment says it's "legal only in given_name_titles"
-- the fuzzer applied it everywhere, so it now tripped the new warning
in every per-word field. Split it into a separate _TITLE_VOCAB used
only for given_name_titles.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… sweep Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ribution Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ntness Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
derek73
added a commit
that referenced
this pull request
Jul 26, 2026
rc2 is rc1 plus the post-rc1 API-polish bundle (PR #290): Role as a StrEnum, the Parser conveniences (matches/capitalized/revise and Policy.patched), the dead-vocabulary repair, the multi-word-entry warning, and the legacy-pickle guard. The release log's "Changed since 2.0.0rc1" section lists what an rc1 tester would notice. Verified: __version__ == "2.0.0rc2" (packaging confirms is_prerelease), the wheel/sdist carry it, and twine check passes on both. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4 tasks
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.
Summary
Fourteen commits fixing the eight findings from the post-rc1 critique of the v2 core API, plus three issues the review rounds surfaced. Everything here lands before 2.0.0 final; two commits are breaking-window items (StrEnum
Role, keyword-onlyas_dict) that could not ship after it.Roleis aStrEnum— members compare and stringify as their field names, matchingAmbiguityKind;tokens_for()coercesRole | strand raisesValueErrorfor unknown roles instead of silently returning nothingParserconveniences —Parser.matches,Parser.capitalized, andParser.revise(tag-preserving field replacement via a sub-parse harvest), because theParsedNameequivalents silently fall back to default config for custom-parser workflows;Policy.patched(patch)applies aPolicyPatchwithout a dummyLocaleSTABLE_TAGSexported with a user-facing docstring;PolicyPatchgets the bounded deviation-only repr its siblings have (and a never-raise_order_repr);ParsedName.as_dict(include_empty=...)keyword-only;HumanNamesubscripting acceptsRolememberschargé d'affairessplit into two chainable title entries (dead since 2013, now recognized); seven multi-word credential acronyms removed (inert in every release, verified against 1.4.0 on PyPI); storing a new multi-word entry now warns, with the warning frame-walked to the caller's own lineConstantspickle drops the eight legacy dead entries instead of warning about vocabulary the user never addedThe release log gains a "Changed since 2.0.0rc1" section for rc testers.
Test Plan
uv run pytest -q)uv run mypy(91 files) anduv run ruff checkclean🤖 Generated with Claude Code