-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
48 lines (39 loc) · 1.34 KB
/
Makefile
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
.DEFAULT_GOAL := all
sources = pytest_examples tests example
.PHONY: .uv # Check that uv is installed
.uv:
@uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
.PHONY: install # Install the package, dependencies, and pre-commit for local development
install: .uv
uv sync --frozen --group lint
uv run pre-commit install --install-hooks
.PHONY: format # Format the code
format:
uv run ruff format
uv run ruff check --fix --fix-only
.PHONY: lint # Lint the code
lint:
uv run ruff format --check
uv run ruff check
.PHONY: typecheck
typecheck:
uv run pyright
.PHONY: test
test:
uv run pytest
.PHONY: test-all-python # Run tests on Python 3.9 to 3.13
test-all-python:
UV_PROJECT_ENVIRONMENT=.venv39 uv run --python 3.9 coverage run -p -m pytest
UV_PROJECT_ENVIRONMENT=.venv310 uv run --python 3.10 coverage run -p -m pytest
UV_PROJECT_ENVIRONMENT=.venv311 uv run --python 3.11 coverage run -p -m pytest
UV_PROJECT_ENVIRONMENT=.venv312 uv run --python 3.12 coverage run -p -m pytest
UV_PROJECT_ENVIRONMENT=.venv313 uv run --python 3.13 coverage run -p -m pytest
@uv run coverage combine
@uv run coverage report
.PHONY: testcov # Run tests and collect coverage data
testcov:
uv run coverage run -m pytest
@uv run coverage report
@uv run coverage html
.PHONY: all
all: format lint typecheck testcov