Skip to content

Commit ace82be

Browse files
committed
switch to hatch for tests, builds, and publishing
fixes #384
1 parent 1582cce commit ace82be

File tree

6 files changed

+57
-73
lines changed

6 files changed

+57
-73
lines changed

MANIFEST.in

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

Makefile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
test: lint pytest documentation examples
1+
test: lint documentation examples pytest
22

33

44
pytest: clean
5-
pytest --cov
5+
pytest -v --cov
66

77

88
documentation: sphinx
@@ -47,20 +47,22 @@ clean:
4747
rm -rf .tox
4848

4949

50-
release_check: clean documentation
51-
tox
50+
checks: clean documentation
51+
-@ pip install -qU hatch
52+
hatch run --force-continue test:checks
5253
@echo version `python -m tatsu --version`
5354

5455

55-
build: clean
56-
pip install -U build
57-
python -m build
56+
build: cleanhatch
57+
-@ pip install -qU hatch
58+
hatch build
5859

5960

60-
test_upload: build
61-
pip install -U twine
62-
twine upload --repository test dist/*
61+
test_publish: build
62+
-@ pip install -qU hatch
63+
hatch publish --repo test
6364

6465

65-
upload: release_check build
66-
twine upload dist/*
66+
publish: checks build
67+
pip install -U hatch
68+
hatch publish

tox.ini renamed to deprecated/tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ whitelist_externals =
99

1010
commands =
1111
ruff check --preview tatsu test examples
12-
mypy --ignore-missing-imports --exclude "parsers|docs|tmp|build|dist" .
12+
mypy --ignore-missing-imports --exclude "parsers|docs|tmp|build|dist" .
1313
pytest
1414

1515
deps =

pyproject.toml

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[old-build-system]
2-
requires = ["setuptools>=46.4", "wheel"]
3-
build-backend = "setuptools.build_meta"
4-
51
[build-system]
62
requires = ["hatchling"]
73
build-backend = "hatchling.build"
@@ -58,8 +54,14 @@ path = "tatsu/_version.py"
5854
packages = ["tatsu"]
5955

6056
[tool.hatch.build.targets.sdist]
61-
packages = ["tatsu"]
62-
include = ["tatsu", "test", "grammar", "examples"]
57+
include = [
58+
"/tatsu",
59+
"/test",
60+
"/grammar",
61+
"/examples",
62+
"*.yaml",
63+
]
64+
excludee = ["deprecated"]
6365

6466
[tool.hatch.envs.hatch-test]
6567
default-args = ["test"]
@@ -70,32 +72,52 @@ dependencies = [
7072
]
7173

7274
# Set default arguments for the pytest command
73-
extra-args = ["-v"]
75+
extra-args = ["-v", "--cov"]
7476

7577
# Enable built-in features
7678
randomize = false # Randomize test order
7779
parallel = false # Run tests in parallel
7880
retries = 0
7981

82+
[tool.pytest.ini_options]
83+
# minversion = "6.0"
84+
#addopts = "-ra -q"
85+
addopts = "-q"
86+
testpaths = [
87+
"test",
88+
]
8089

81-
[tool.setuptools]
82-
include-package-data = false
83-
84-
[tool.setuptools.dynamic]
85-
version = {attr = "tatsu._version.__version__"}
86-
87-
[tool.setuptools.packages.find]
88-
include = ["tatsu*"]
89-
90+
[tool.ruff]
91+
line-length = 88
9092

91-
[tool.blue]
92-
target-version = ["py314"]
93-
line-length=79
94-
skip-magic-trailing-comma=true
93+
# The minimum Python version to support
94+
# target-version = "py311"
9595

96+
# Files or directories to exclude from linting/formatting
97+
exclude = [
98+
".git",
99+
"__pycache__",
100+
"dist",
101+
]
96102

97103
[tool.coverage.run]
98104
omit = [
99105
"test/*",
100106
"tatsu/diagrams.py",
101107
]
108+
[tool.hatch.envs.test]
109+
dependencies = ["pytest", "mypy", "ruff"]
110+
111+
[tool.hatch.envs.test.scripts]
112+
lint = "ruff check -q --preview tatsu test examples"
113+
types = "mypy --exclude 'parsers|docs|tmp|build|dist' ."
114+
tests = "pytest"
115+
116+
checks = [
117+
"lint",
118+
"types",
119+
"tests"
120+
]
121+
122+
[[tool.hatch.envs.test.matrix]]
123+
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ hatch
55
ipython
66
pip
77
psutil
8-
twine

requirements-test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ ruff
1111
setuptools
1212
sphinx
1313
sphinx-rtd-theme
14-
tox

0 commit comments

Comments
 (0)