-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 1.81 KB
/
Copy pathMakefile
File metadata and controls
58 lines (46 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
all: clean fmt test coverage
# Ensure that all uv commands don't automatically update the lock file: instead they use the locked dependencies.
export UV_FROZEN := 1
# Ensure that hatchling is pinned when builds are needed.
export UV_BUILD_CONSTRAINT := .build-constraints.txt
UV_RUN := uv run --exact --all-extras
UV_TEST := $(UV_RUN) pytest --timeout 30 --durations 20 --cov=src
clean:
rm -fr .venv clean htmlcov .mypy_cache .pytest_cache .ruff_cache .coverage coverage.xml
find . -name '__pycache__' -print0 | xargs -0 rm -fr
dev:
uv sync --all-extras
lint:
$(UV_RUN) isort . --check-only
$(UV_RUN) ruff format --check --diff
$(UV_RUN) ruff check .
$(UV_RUN) mypy .
$(UV_RUN) pylint --output-format=colorized -j 0 src
fmt:
$(UV_RUN) isort .
$(UV_RUN) ruff format
$(UV_RUN) ruff check . --fix
$(UV_RUN) mypy .
$(UV_RUN) pylint --output-format=colorized -j 0 src
test:
$(UV_TEST) --cov src --cov-report=xml tests/unit
integration:
$(UV_TEST) --cov src --cov-report=xml tests/integration
coverage:
$(UV_TEST) --cov src --cov-report=html tests/unit
open htmlcov/index.html
build:
uv build --require-hashes --build-constraints=.build-constraints.txt
lock-dependencies: UV_FROZEN := 0
lock-dependencies:
uv lock --upgrade
$(UV_RUN) --group yq tomlq -r '.["build-system"].requires[]' pyproject.toml | \
uv pip compile --upgrade --generate-hashes --universal --no-header --quiet - > build-constraints-new.txt
mv build-constraints-new.txt .build-constraints.txt
@perl -pi \
-e 's|registry = "https://[^"]*"|registry = "https://pypi.org/simple"|g;' \
-e 's|url = "https://[^"]*/packages/([^"]*)"|url = "https://files.pythonhosted.org/packages/$$1"|g;' \
uv.lock
@printf 'Stripped registry references from uv.lock.\n'
.DEFAULT: all
.PHONY: all clean dev lint fmt test integration coverage build lock-dependencies