Skip to content

feat: add given_names attribute (closes #157)#180

Merged
derek73 merged 2 commits into
masterfrom
feat/given-names
Jun 29, 2026
Merged

feat: add given_names attribute (closes #157)#180
derek73 merged 2 commits into
masterfrom
feat/given-names

Conversation

@derek73

@derek73 derek73 commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a given_names attribute (and given_names_list) that returns the first name followed by all middle names — the given-name counterpart to the existing surnames attribute (middle + last). The two aggregates deliberately overlap on middle, as convenience views over the parse buckets.

Reimplemented fresh on current master rather than merging #157, which was based on a pre-refactor codebase (pre type-hints, tests.py monolith, __unicode__) and had drifted into mostly-unrelated style churn. Supersedes and closes #157; credit to @fdesoye for the original feature and naming idea. Named given_names/given_names_list (plural) to parallel surnames/surnames_list.

Changes

  • nameparser/parser.pygiven_names_list + given_names properties; added to the class docstring attribute list
  • tests/test_python_api.py — two tests paralleling the surnames tests (written test-first)
  • docs/usage.rst — a given_names doctest beside the surnames example
  • docs/release_log.rst — Unreleased entry

Verification

  • uv run pytest — 829 passed, 0 failed (dual fixture also covers empty_attribute_default=None)
  • uv run mypy nameparser/ — clean
  • uv run ruff check nameparser/ tests/ — clean

Closes #157

🤖 Generated with Claude Code

derek73 and others added 2 commits June 29, 2026 14:33
…loses #157)

Adds given_names (and given_names_list), the first name followed by all
middle names, mirroring the existing surnames attribute (middle + last).
Reimplemented fresh on current master from the approach in #157, which was
based on a pre-refactor codebase and had drifted.

Co-Authored-By: fdesoye <fdesoye@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…attern in AGENTS.md

Covers the `or self.C.empty_attribute_default` branch (untested before this commit)
and the no-middle boundary case. Also adds a note to AGENTS.md reminding future
contributors to include an empty-path test for any new aggregate property.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@derek73 derek73 self-assigned this Jun 29, 2026
@derek73 derek73 added this to the v1.3.0 milestone Jun 29, 2026
@derek73 derek73 merged commit b279a2a into master Jun 29, 2026
8 checks passed
@derek73 derek73 deleted the feat/given-names branch June 29, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant