summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMurilo Ijanc <[email protected]>2026-07-26 11:44:58 -0300
committerMurilo Ijanc <[email protected]>2026-07-26 11:44:58 -0300
commita82459630e957a8d94c375394dae66734f3c90c1 (patch)
treed9d1b9e1249ccd8cd1d989f532c6368a70dc9cc2 /Makefile
downloadpython-0.1.0.tar.gz
Initial importv0.1.0
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile69
1 files changed, 69 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6d804a1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,69 @@
+# Development tasks. Everything runs through `uv`, so there is nothing to
+# install first and no virtualenv to activate by hand.
+#
+# make list the targets
+# make test run the suite on PYTHON (default: the minimum supported)
+# make lint ruff check + format check, no files touched
+# make build wheel + sdist into dist/
+#
+# PYTHON pins the interpreter uv resolves. It defaults to 3.9 — the minimum
+# this package claims to support — because that is the version most likely to
+# catch a syntax or stdlib assumption that a newer one silently accepts.
+PYTHON ?= 3.9
+
+# Every 3.x this package claims to support, for `make test-all`. Keep in sync
+# with requires-python in pyproject.toml.
+PYTHON_VERSIONS := 3.9 3.10 3.11 3.12 3.13 3.14
+
+UV ?= uv
+RUN := $(UV) run --python $(PYTHON) --with-editable .
+
+.DEFAULT_GOAL := help
+.PHONY: help test test-all lint format build clean check
+
+help:
+ @echo 'Targets:'
+ @echo ' test run the test suite (PYTHON=$(PYTHON))'
+ @echo ' test-all run it on every supported Python: $(PYTHON_VERSIONS)'
+ @echo ' lint ruff check + ruff format --check (read-only)'
+ @echo ' format apply ruff format and ruff check --fix (writes)'
+ @echo ' build build the wheel and sdist into dist/'
+ @echo ' check lint + test + build, in that order'
+ @echo ' clean remove build artefacts and caches'
+ @echo
+ @echo 'Override the interpreter with e.g. make test PYTHON=3.13'
+
+test:
+ $(RUN) python -m unittest discover -s tests -v
+
+# Sequential, not parallel: uv may need to download an interpreter, and
+# interleaved unittest output from six runs is unreadable when one fails.
+# `set -e` inside the loop is what makes a failure on 3.10 stop the run instead
+# of being masked by a later success.
+test-all:
+ @set -e; for v in $(PYTHON_VERSIONS); do \
+ echo "==> Python $$v"; \
+ $(UV) run --python $$v --with-editable . python -m unittest discover -s tests; \
+ done
+
+# Read-only by design, so it is safe in CI and in a pre-commit hook: it reports
+# what `make format` would change without changing anything.
+lint:
+ $(UV)x ruff check .
+ $(UV)x ruff format --check .
+
+format:
+ $(UV)x ruff format .
+ $(UV)x ruff check --fix .
+
+build:
+ $(UV) build
+
+# The order matters: lint is the fastest to fail, build the slowest, so a
+# broken run reports the cheapest problem first.
+check: lint test build
+
+clean:
+ rm -rf dist build .ruff_cache .venv
+ find . -name '__pycache__' -type d -prune -exec rm -rf {} +
+ find . -name '*.egg-info' -type d -prune -exec rm -rf {} +