Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/runs-on.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_extends: repo-settings
57 changes: 57 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Automate generation of release PRs using Conventional Commits
# See https://github.com/googleapis/release-please

name: release-please

on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
release-please:
timeout-minutes: 30
runs-on: ubuntu-latest
# expose the step outputs at the job level so other jobs can use them
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Run release-please
id: release
uses: googleapis/release-please-action@v4
with:
# Use whatever token you currently use; GITHUB_TOKEN also works
token: ${{ secrets.GHA_NODEJS_TOKEN }}
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json

publish:
name: Build & publish to PyPI
needs: release-please
# only run if a release/tag was created by the job above
if: ${{ needs.release-please.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
# not strictly required by pypa/gh-action-pypi-publish, but fine to leave minimal
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install build backend
run: |
python -m pip install --upgrade pip
pip install build

- name: Build sdist and wheel
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.10.2
with:
password: ${{ secrets.PYPI_API_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run Unit Tests

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
run-unit-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Set up Just
uses: extractions/setup-just@v3

- name: Install UV
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Install dependencies
run: |
uv sync
uv pip install -e .

- name: Copy .env.template to .env
run: |
cp .env.template .env

- name: Run linting
run: |
just lint
20 changes: 20 additions & 0 deletions .release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"changelog-sections": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "perf", "section": "Performance Improvements"},
{"type": "docs", "section": "Documentation", "hidden": false},
{"type": "style", "section": "Styles", "hidden": false},
{"type": "refactor", "section": "Code Refactoring", "hidden": false},
{"type": "test", "section": "Tests", "hidden": false},
{"type": "build", "section": "Build System", "hidden": false},
{"type": "ci", "section": "Continuous Integration", "hidden": false},
{"type": "chore", "section": "Miscellaneous Chores", "hidden": false},
{"type": "revert", "section": "Reverts"}
],
"packages": {
".": {
"release-type": "python"
}
}
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0"
}
102 changes: 102 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# types-nameparser

[![PyPI version](https://badge.fury.io/py/types-nameparser.svg)](https://badge.fury.io/py/types-nameparser)
[![Python versions](https://img.shields.io/pypi/pyversions/types-nameparser.svg)](https://pypi.org/project/types-nameparser/)

Typing stubs for the [nameparser](https://github.com/derek73/python-nameparser) library.

## Overview

This package provides type information (stub files) for the `nameparser` library, enabling better IDE support and static type checking when working with human name parsing functionality.

The `nameparser` library is a Python library for parsing human names into their component parts (first name, last name, middle name, title, suffix, etc.), but it doesn't include type hints. This package fills that gap by providing comprehensive type stubs.

## Installation

```bash
pip install types-nameparser
```

Or if you're using [uv](https://github.com/astral-sh/uv):

```bash
uv add types-nameparser
```

## Usage

After installation, you can use the type stubs with your existing `nameparser` code:

```python
from nameparser import HumanName

# Now you get full type hints and IDE support!
name = HumanName("Dr. John Michael Smith Jr.")
print(name.first) # "John"
print(name.last) # "Smith"
print(name.middle) # "Michael"
print(name.title) # "Dr."
print(name.suffix) # "Jr."
```

## Type Information

The stubs provide type information for the `HumanName` class with the following properties:

- `first: str` - First name component
- `last: str` - Last name component
- `middle: str` - Middle name component
- `title: str` - Title component (Mr., Mrs., Dr., etc.)
- `suffix: str` - Suffix component (Jr., Sr., III, etc.)
- `nickname: str` - Nickname component

## Development

This project uses [uv](https://github.com/astral-sh/uv) for dependency management and [just](https://github.com/casey/just) for task running.

### Setup

```bash
# Install dependencies
just install
```

### Available Commands

```bash
# Run linting
just lint

# Run linting with auto-fix
just lint-fix

# Format code
just format

# Type checking
just type-check

# Run tests
just test

# Run tests with coverage
just test-cov
```

## Requirements

- Python 3.10+
- The actual `nameparser` library (this package only provides type stubs)

## License

This project is licensed under the same terms as the original `nameparser` library.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

## Related Projects

- [nameparser](https://github.com/derek73/python-nameparser) - The original name parsing library
- [typeshed](https://github.com/python/typeshed) - Collection of type stubs for Python standard library and third-party packages
Loading