Skip to content

Commit f4c5582

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 f4c5582

5 files changed

Lines changed: 51 additions & 10 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,26 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
20+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2121

2222
steps:
23-
- uses: actions/checkout@v6
23+
- uses: actions/checkout@v4
2424
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v6
25+
uses: actions/setup-python@v5
2626
with:
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
35+
- name: Check types
36+
run: mypy
3537
- name: Run Tests
3638
run: |
3739
python tests.py
38-
python -m build --sdist
40+
python setup.py sdist
3941
twine check dist/*
4042
sphinx-build -b html docs dist/docs

.python-version

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

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)