Skip to content

Commit 309c314

Browse files
committed
Switch build from hatchling to setuptools
Replaces `tox` with hatch environments Replaces setuptools_scm with hatch-vcs (https://github.com/ofek/hatch-vcs) Testing with `hatch` is vastly faster than with tox, because it uses `uv` instead of virtualenv and pip.
1 parent 044cec3 commit 309c314

File tree

3 files changed

+29
-42
lines changed

3 files changed

+29
-42
lines changed

Justfile

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,10 @@ mypy:
2929
uv run mypy src
3030

3131
# runs tests without anything else
32-
_test: test-single
33-
@just _test_ver 3.13
34-
@just _test_ver 3.12
35-
@just _test_ver 3.11
36-
@just _test_ver 3.10
37-
@just _test_ver 3.9
32+
_test:
33+
hatch test --all
3834

3935

40-
# runs python tests for a specific version
41-
_test_ver pyver:
42-
# running tests for python {{pyver}}
43-
@# NOTE: Using `uv` is vastly faster than using `tox`
44-
@# Using --isolated avoids clobbering dev environment
45-
@uv run --isolated --python {{pyver}} --only-group test pytest --quiet
46-
4736
# Check for spelling issues
4837
spellcheck:
4938
# Check for obvious spelling issues

pyproject.toml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pydantic = [
2424

2525
[dependency-groups]
2626
mypy = ["mypy~=1.0", { include-group = "typing" }]
27+
# keep in sync with [tool.hatch.envs] until hatch supports PEP 754
2728
test = [
2829
"pytest~=8.3",
2930
"pytest-asyncio>=0.26",
@@ -38,19 +39,38 @@ Source = "https://github.com/Techcable/orderedset.py"
3839

3940
[build-system]
4041
requires = [
41-
"setuptools>=61.0",
42-
"setuptools_scm[toml]>=6.2",
42+
"hatchling",
43+
"hatch-vcs",
4344
]
44-
build-backend = "setuptools.build_meta"
45+
build-backend = "hatchling.build"
4546

46-
[tool.isort]
47-
profile = "black"
4847

49-
[tool.setuptools_scm]
48+
[tool.hatch.version]
49+
source = "vcs"
50+
51+
[tool.hatch.envs.hatch-test]
52+
# use uv instead of venv/pip
53+
installer = "uv"
54+
# Keep in sync with dependency-groups until hatch supports PEP 754
55+
# See pypa/hatch#1852
56+
dependencies = [
57+
"pytest~=8.3",
58+
"pytest-asyncio>=0.26",
59+
"pytest-sugar~=1.0",
60+
]
61+
extra-dependencies = ["pydantic"]
62+
63+
[[tool.hatch.envs.hatch-test.matrix]]
64+
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
65+
66+
[tool.hatch.build.hooks.vcs]
5067
# NOTE: Using a version file avoids some overhead
5168
#
5269
# This file is explicitly ignored by version control.
53-
write_to = "src/techcable/orderedset/_version.py"
70+
version-file = "src/techcable/orderedset/_version.py"
71+
72+
[tool.isort]
73+
profile = "black"
5474

5575
[tool.ruff]
5676
line-length = 120

tox.ini

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

0 commit comments

Comments
 (0)