Skip to content

Commit f558982

Browse files
authored
Merge pull request #18 from python-packaging/thatch/modernized-metadata
Use PEP 621 Metadata, use uv sync
2 parents adae100 + 796e282 commit f558982

12 files changed

Lines changed: 684 additions & 152 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
- tmp-*
9+
pull_request:
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
allow-prereleases: true
28+
29+
- name: Set up uv
30+
uses: astral-sh/setup-uv@v6
31+
32+
- name: Install dependencies
33+
run: uv sync --group dev
34+
35+
- name: Run tests
36+
run: make test

‎Makefile‎

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,29 @@
11
PYTHON?=python
22
SOURCES=regen.py regen-git.py test_skel.py
33

4-
UV:=$(shell uv --version)
5-
ifdef UV
6-
VENV:=uv venv
7-
PIP:=uv pip
8-
else
9-
VENV:=python -m venv
10-
PIP:=python -m pip
11-
endif
12-
134
.PHONY: venv
14-
venv:
15-
$(VENV) .venv
16-
source .venv/bin/activate && make setup
5+
venv: setup
176
@echo 'run `source .venv/bin/activate` to use virtualenv'
187

19-
# The rest of these are intended to be run within the venv, where python points
20-
# to whatever was used to set up the venv.
21-
228
.PHONY: setup
239
setup:
24-
$(PIP) install -Ur requirements-dev.txt
10+
uv sync --group dev
11+
12+
.PHONY: test
13+
test:
14+
uv run coverage run -m pytest $(TESTOPTS)
15+
uv run coverage report
2516

2617
.PHONY: format
2718
format:
28-
ruff format
29-
ruff check --fix
19+
uv run ruff format
20+
uv run ruff check --fix
3021

3122
.PHONY: lint
3223
lint:
33-
ruff check $(SOURCES)
34-
mypy --strict $(SOURCES)
24+
uv run ruff check $(SOURCES)
25+
uv run mypy --strict $(SOURCES)
3526

3627
.PHONY: checkdeps
3728
checkdeps:
38-
python -m checkdeps . --allow-names regen
29+
uv run python -m checkdeps . --allow-names regen

‎pyproject.toml‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,47 @@
1+
[project]
2+
name = "skel"
3+
version = "0"
4+
requires-python = ">=3.10"
5+
dependencies = []
6+
7+
[dependency-groups]
8+
dev = [
9+
"build >= 1",
10+
"checkdeps == 0.9.0",
11+
"coverage >= 7.14",
12+
"mypy == 1.8.0",
13+
"pytest >= 8",
14+
"ruff == 0.8.0",
15+
"volatile == 2.1.0",
16+
"wheel == 0.42.0",
17+
]
18+
19+
[tool.coverage.run]
20+
branch = true
21+
parallel = true
22+
source = ["regen"]
23+
24+
[tool.coverage.report]
25+
fail_under = 30
26+
precision = 1
27+
show_missing = true
28+
skip_covered = true
29+
30+
[tool.pytest.ini_options]
31+
addopts = "-ra"
32+
testpaths = ["."]
33+
python_files = ["test_*.py"]
34+
135
[tool.ruff]
236
line-length = 88
37+
target-version = "py310"
338

439
[tool.ruff.lint]
5-
extend-select = [
40+
select = [
41+
"E4",
42+
"E7",
43+
"E9",
44+
"F",
645
"I", # isort
746
]
847

‎requirements-dev.txt‎

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

‎templates/.github/workflows/build.yml.in‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ on:
99
- v*
1010
pull_request:
1111

12-
env:
13-
UV_SYSTEM_PYTHON: 1
14-
1512
jobs:
1613
test:
1714
runs-on: ${{ matrix.os }}
@@ -31,8 +28,7 @@ jobs:
3128
allow-prereleases: true
3229
- uses: astral-sh/setup-uv@v3
3330
- name: Install
34-
run: |
35-
uv pip install -e .[test,dev]
31+
run: uv sync --extra test --extra dev
3632
- name: Test
3733
run: |
3834
git config --global user.name "Unit Test"
@@ -52,9 +48,9 @@ jobs:
5248
python-version: "3.14"
5349
- uses: astral-sh/setup-uv@v3
5450
- name: Install
55-
run: uv pip install build
51+
run: uv sync --extra test --extra dev
5652
- name: Build
57-
run: python -m build
53+
run: uv run python -m build
5854
- name: Upload
5955
uses: actions/upload-artifact@v4
6056
with:
@@ -65,7 +61,9 @@ jobs:
6561
needs: build
6662
runs-on: ubuntu-latest
6763
if: startsWith(github.ref, 'refs/tags/v')
64+
environment: pypi
6865
permissions:
66+
contents: read
6967
id-token: write
7068
steps:
7169
- uses: actions/download-artifact@v4

‎templates/MANIFEST.in.in‎

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

‎templates/Makefile.in‎

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,22 @@
1-
ifeq ($(OS),Windows_NT)
2-
ACTIVATE:=.venv/Scripts/activate
3-
else
4-
ACTIVATE:=.venv/bin/activate
5-
endif
6-
7-
UV:=$(shell uv --version)
8-
ifdef UV
9-
VENV:=uv venv
10-
PIP:=uv pip
11-
else
12-
VENV:=python -m venv
13-
PIP:=python -m pip
14-
endif
15-
161
.venv:
17-
$(VENV) .venv
2+
uv sync --extra dev --extra test
183

194
.PHONY: setup
20-
setup: .venv
21-
source $(ACTIVATE) && $(PIP) install -Ue .[dev,test]
5+
setup:
6+
uv sync --extra dev --extra test
227

238
.PHONY: test
249
test:
25-
python -m coverage run -m pytest $(TESTOPTS)
26-
python -m coverage report
10+
uv run coverage run -m pytest $(TESTOPTS)
11+
uv run coverage report
2712

2813
.PHONY: format
2914
format:
30-
ruff format
31-
ruff check --fix
15+
uv run ruff format
16+
uv run ruff check --fix
3217

3318
.PHONY: lint
3419
lint:
35-
ruff check
36-
python -m checkdeps --allow-names {package} {package}
37-
mypy --strict --install-types --non-interactive {package}
20+
uv run ruff check
21+
uv run python -m checkdeps --allow-names {package} {package}
22+
uv run mypy --strict --install-types --non-interactive {package}

‎templates/pyproject.toml‎

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

‎templates/pyproject.toml.in‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[build-system]
2+
requires = [
3+
"setuptools >= 77",
4+
"setuptools-scm >= 8",
5+
]
6+
build-backend = "setuptools.build_meta"
7+
8+
[project]
9+
name = "{pypi_name}"
10+
description = "{short_desc}"
11+
readme = "README.md"
12+
requires-python = ">=3.10"
13+
license = "MIT"
14+
authors = [
15+
{ name = "{author}", email = "{author_email}" },
16+
]
17+
classifiers = [
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: 3.14",
24+
]
25+
dynamic = ["version"]
26+
dependencies = []
27+
28+
[project.urls]
29+
Homepage = "{url}"
30+
31+
[project.optional-dependencies]
32+
dev = [
33+
"build >= 1",
34+
"checkdeps == 0.9.0",
35+
"mypy == 1.19.1",
36+
"ruff == 0.15.6",
37+
]
38+
test = [
39+
"coverage >= 7.14",
40+
"pytest >= 8",
41+
]
42+
43+
[project.scripts]
44+
# foo = "foo:bar"
45+
46+
[tool.setuptools]
47+
packages = { find = {} }
48+
include-package-data = true
49+
50+
[tool.setuptools.package-data]
51+
"{package}" = ["py.typed"]
52+
53+
[tool.setuptools_scm]
54+
version_file = "{package}/_version.py"
55+
56+
[tool.coverage.run]
57+
branch = true
58+
parallel = true
59+
source = ["{package}", "tests"]
60+
61+
[tool.coverage.report]
62+
fail_under = 70
63+
precision = 1
64+
show_missing = true
65+
skip_covered = true
66+
67+
[tool.pytest.ini_options]
68+
addopts = "-ra"
69+
testpaths = ["tests"]
70+
71+
[tool.mypy]
72+
ignore_missing_imports = true
73+
74+
[tool.ruff]
75+
line-length = 88
76+
target-version = "py310"
77+
78+
[tool.ruff.lint]
79+
select = [
80+
"E4",
81+
"E7",
82+
"E9",
83+
"F",
84+
"I", # isort
85+
]
86+
87+
[tool.ruff.lint.isort]
88+
order-by-type = false
89+
90+
[tool.ruff.lint.per-file-ignores]
91+
"tests/*" = [
92+
"PLR2004", # Magic value used instead of constant (only in tests)
93+
]

0 commit comments

Comments
 (0)