-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (47 loc) · 1.81 KB
/
Copy pathMakefile
File metadata and controls
60 lines (47 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Development tasks for the tensicai SDK. Everything runs through uv.
#
# make install create/update .venv with the dev extras
# make check lint + typecheck + test (what CI runs)
# make test-all run the test-suite on every supported Python version
UV ?= uv
PYTHON_VERSIONS ?= 3.10 3.11 3.12 3.13 3.14
.PHONY: help install lint format typecheck test test-all build check clean publish-test
help:
@echo "install uv sync --extra dev"
@echo "lint ruff check + ruff format --check"
@echo "format ruff format + ruff check --fix"
@echo "typecheck mypy src examples (strict)"
@echo "test pytest on the current interpreter"
@echo "test-all pytest on Python $(PYTHON_VERSIONS)"
@echo "build uv build + twine check"
@echo "check lint + typecheck + test"
@echo "clean remove build artefacts and caches"
@echo "publish-test upload dist/* to TestPyPI (twine)"
install:
$(UV) sync --extra dev
lint:
$(UV) run ruff check src tests examples
$(UV) run ruff format --check src tests examples
format:
$(UV) run ruff format src tests examples
$(UV) run ruff check --fix src tests examples
typecheck:
$(UV) run mypy src examples
test:
$(UV) run pytest -q
test-all:
@for v in $(PYTHON_VERSIONS); do \
echo "=== Python $$v ==="; \
$(UV) run --python $$v --isolated --extra dev pytest -q || exit 1; \
done
build: clean
$(UV) build
$(UV) run twine check dist/*
check: lint typecheck test
clean:
rm -rf dist build src/*.egg-info .mypy_cache .ruff_cache .pytest_cache
find . -name __pycache__ -type d -prune -exec rm -rf {} +
# Rehearse a release against TestPyPI. Needs a TestPyPI API token:
# TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-... make publish-test
publish-test: build
$(UV) run twine upload --repository-url https://test.pypi.org/legacy/ dist/*