Skip to content

nameparser 2.0: a new core API, with full compatibility through 2.x — direction and feedback #284

Description

@derek73

nameparser 2.0 is in design. This issue is the front door: the short version, links to the full design, and the specific feedback that would help most. There is no deadline — comment whenever; implementation will proceed in parallel and alphas will be announced here.

The promise

Code that runs warning-free on 1.4 keeps running on every 2.x release with identical results, getting at most DeprecationWarnings. HumanName continues to work as a compatibility layer. The old API is removed in 3.0, not 2.x, and only after every removal has warned first. If you use HumanName and don't customize configuration, 2.0 should be a non-event.

What's new

A second, immutable API alongside HumanName:

from nameparser import parse

name = parse("Dr. Juan Q. Xavier de la Vega III")
name.given         # "Juan"      (the new API says given/family, not first/last)
name.family        # "de la Vega"
name.family_base   # "Vega"
  • parse() returns a frozen value object; no mutable state anywhere in the new API
  • configuration becomes immutable Lexicon (vocabulary) + Policy (behavior) objects you build at startup — no more mutating shared CONSTANTS (which keeps working through 2.x, with a warning)
  • family-first name order (Policy(name_order=FAMILY_FIRST)) and opt-in locale packs (RU, TR_AZ at 2.0.0; zh/ko/vi/ja staged)
  • genuinely ambiguous parses are reported (name.ambiguities) instead of silently guessed
  • still deterministic, rules-based, zero dependencies; Python ≥ 3.11

Read and comment

Feedback that would help most

  1. Do you compare HumanName objects with == (especially against strings), or use them in sets/dicts? (2.0 changes this to object identity — warned since 1.3.0; matches()/comparison_key() are the replacements. The one silent behavior change.)
  2. Do you subclass HumanName and override parsing methods? Tell us what the override does — we'd rather absorb it as a feature than break it silently (HumanName subclasses overriding parsing hooks silently lose their overrides under the 2.0 facade; detect and warn at construction #280).
  3. Do you mutate CONSTANTS after startup, not just at import time?
  4. Do you assign custom regexes to CONSTANTS.regexes? What for?
  5. given/family instead of first/last in the new API — help or annoy?
  6. Do you build anything on top of nameparser where the promise above would still break you?

Activity

  1. added this to the v2.0 milestone on Jul 12, 2026
  2. pinned this issue on Jul 12, 2026
  3. self-assigned this
    on Jul 12, 2026
  4. derek73 commented on Jul 24, 2026

    @derek73
    OwnerAuthor

    2.0.0rc1 is now on PyPI. 🎉

    pip install --pre nameparser==2.0.0rc1
    

    A plain pip install nameparser still gets 1.4.0 — the release candidate is opt-in. HumanName keeps working unchanged; the new API is parse() → an immutable ParsedName. See the 2.0 docs and the migration guide.

    Please try it against your real code and report anything the migration missed here. The one change that can bite silently: HumanName(...) == "some string" is now False — use matches().

    Final 2.0.0 follows once the RC settles.

  5. added a commit that references this issue on Jul 24, 2026
  6. removed this from the v2.0 milestone on Jul 28, 2026
  7. derek73 commented on Aug 7, 2026

    @derek73
    OwnerAuthor

    Closing: 2.0's migration is done and 2.1 is ready to ship. The README banner now points at the tracker rather than this thread, so please open a new issue for anything that parses wrong.

  8. unpinned this issue on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions