-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 1.55 KB
/
Copy pathMakefile
File metadata and controls
59 lines (46 loc) · 1.55 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
VENV := .venv
PYTHON := $(VENV)/bin/python
PIP := $(VENV)/bin/pip
.PHONY: help install lint format typecheck test tox pre-commit build publish clean
help:
@echo "Usage: make <target>"
@echo ""
@echo " install set up the virtual environment"
@echo " lint run ruff"
@echo " format run black"
@echo " typecheck run mypy"
@echo " test run pytest with coverage"
@echo " tox run tests across py38, py310, py312"
@echo " pre-commit install pre-commit hooks"
@echo " build build sdist and wheel"
@echo " publish upload to PyPI with twine"
@echo " clean remove build artifacts and caches"
$(VENV)/bin/activate: pyproject.toml
python3 -m venv $(VENV)
$(PIP) install --upgrade pip
$(PIP) install -e ".[dev]"
touch $(VENV)/bin/activate
install: $(VENV)/bin/activate
@echo "Virtual environment ready at $(VENV)/"
lint: $(VENV)/bin/activate
$(VENV)/bin/ruff check miette tests
format: $(VENV)/bin/activate
$(VENV)/bin/black miette tests
typecheck: $(VENV)/bin/activate
$(VENV)/bin/mypy miette
test: $(VENV)/bin/activate
$(VENV)/bin/pytest --cov=miette --cov-report=term-missing
tox: $(VENV)/bin/activate
$(VENV)/bin/tox
build: $(VENV)/bin/activate
$(PIP) install build
$(PYTHON) -m build
publish: build
$(PIP) install twine
$(VENV)/bin/twine upload dist/*
pre-commit: $(VENV)/bin/activate
$(VENV)/bin/pre-commit install
clean:
rm -rf $(VENV) build dist *.egg-info .mypy_cache .ruff_cache .pytest_cache __pycache__
find . -type d -name __pycache__ -exec rm -rf {} +
find . -name "*.pyc" -delete