Skip to content

Commit 8a98b37

Browse files
committed
Add pyproject.toml metadata
This includes a build system specification (PEP 518) and essential metadata (PEP 621). This configuration is needed for modern tooling. Migrate dev-dependencies.txt to pyproject.toml and add ruff and mypy. Also add a PEP 561 py.typed marker and a .python-version file.
1 parent 85dec89 commit 8a98b37

7 files changed

Lines changed: 49 additions & 8 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ jobs:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install dependencies
2929
run: |
30-
python -m pip install --upgrade pip setuptools
31-
python -m pip install build
30+
python -m pip install --upgrade pip
31+
python -m pip install --group dev
3232
python -m pip install twine
33-
python -m pip install sphinx
34-
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
33+
- name: Run linter
34+
run: ruff check
35+
- name: Check types
36+
run: mypy
3537
- name: Run Tests
3638
run: |
3739
python tests.py

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
```bash
88
# Install dev dependencies
9-
pip install -r dev-requirements.txt
9+
pip install --group dev
1010

1111
# Run all tests
1212
python tests.py

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Development Environment Setup
66

77
Install dev dependencies:
88

9-
pip install -r dev-requirements.txt
9+
pip install --group dev
1010

1111
Running Tests
1212
---------------

dev-requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

nameparser/py.typed

Whitespace-only changes.

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[project]
2+
name = "nameparser"
3+
readme = "README.rst"
4+
requires-python = ">=3.10"
5+
dynamic = ["version", "description", "license", "authors"]
6+
dependencies = [
7+
"typing_extensions (>=4.5.0); python_version < '3.11'"
8+
]
9+
10+
[build-system]
11+
# nameparser is a build requirement of itself because it is imported in setup.py
12+
requires = ["setuptools (>=82.0.1)", "nameparser"]
13+
build-backend = "setuptools.build_meta"
14+
15+
[dependency-groups]
16+
dev = [
17+
"dill (>=0.2.5)",
18+
"sphinx (>=8)",
19+
"mypy (>=2.1)",
20+
"ruff (>=0.15)"
21+
]
22+
23+
[tool.mypy]
24+
packages = ["nameparser"]
25+
26+
[[tool.mypy.overrides]]
27+
module = [
28+
"dill.*",
29+
]
30+
ignore_missing_imports = true
31+
32+
[tool.ruff.lint]
33+
select = [
34+
"ANN", # flake8-annotations
35+
"UP", # pyupgrade
36+
]
37+
ignore = [
38+
"UP031", # printf-string-formatting (the code already uses % formatting)
39+
"UP032", # f-string (the code already uses str.format)
40+
]

0 commit comments

Comments
 (0)