1- .PHONY : help install install-dev clean test coverage lint format type-check build upload upload-test venv
1+ PYTHON ?= python3.14
2+ SOURCES = energy_tracker_api/ tests/ scripts/ example.py
3+
4+ .PHONY : help install install-dev clean test coverage lint format type-check build check-dist upload upload-test venv all
25
36help :
47 @echo " Available commands:"
@@ -12,22 +15,24 @@ help:
1215 @echo " make format - Format code with black and isort"
1316 @echo " make type-check - Run type checking with mypy"
1417 @echo " make build - Build distribution packages"
18+ @echo " make check-dist - Validate packages and test an isolated wheel installation"
1519 @echo " make upload-test - Upload to TestPyPI"
1620 @echo " make upload - Upload to PyPI"
1721
1822venv/bin/python :
1923 @echo " Creating virtual environment..."
20- python3 -m venv venv
24+ $( PYTHON ) -m venv venv
2125 @echo " Upgrading pip..."
2226 venv/bin/pip install --upgrade pip
2327
24- .install-stamp : venv/bin/python requirements.txt
25- venv/bin/pip install -r requirements.txt
28+ venv : venv/bin/python
29+
30+ .install-stamp : venv/bin/python pyproject.toml
2631 venv/bin/pip install -e .
2732 @touch .install-stamp
2833
29- .install-dev-stamp : .install-stamp requirements-dev.txt
30- venv/bin/pip install -r requirements-dev.txt
34+ .install-dev-stamp : .install-stamp pyproject.toml
35+ venv/bin/pip install -e ' .[dev] '
3136 @touch .install-dev-stamp
3237
3338install : .install-stamp
@@ -42,35 +47,39 @@ clean:
4247 rm -rf .mypy_cache/
4348 rm -rf htmlcov/
4449 rm -rf .coverage
45- rm -rf venv/
50+ rm -f coverage.xml
4651 rm -rf .install-stamp .install-dev-stamp
47- find . -type d -name __pycache__ -exec rm -rf {} +
48- find . -type f -name " *.pyc" -delete
52+ find energy_tracker_api tests scripts -type d -name __pycache__ -exec rm -rf {} +
4953
5054test : .install-dev-stamp
5155 venv/bin/python -m pytest tests/ -v
5256
5357coverage : .install-dev-stamp
54- venv/bin/python -m pytest tests/ --cov=energy_tracker_api --cov-report=html --cov-report=term
58+ venv/bin/python -m pytest tests/ --cov=energy_tracker_api --cov-report=html --cov-report=term --cov-report=xml
5559
5660lint : .install-dev-stamp
57- venv/bin/python -m black --check energy_tracker_api/ tests/
58- venv/bin/python -m isort --check-only energy_tracker_api/ tests/
61+ venv/bin/python -m black --check $( SOURCES )
62+ venv/bin/python -m isort --check-only $( SOURCES )
5963
6064format : .install-dev-stamp
61- venv/bin/python -m black energy_tracker_api/ tests/
62- venv/bin/python -m isort energy_tracker_api/ tests/
65+ venv/bin/python -m isort $( SOURCES )
66+ venv/bin/python -m black $( SOURCES )
6367
6468type-check : .install-dev-stamp
65- venv/bin/python -m mypy energy_tracker_api/
69+ venv/bin/python -m mypy energy_tracker_api/ scripts/ example.py
6670
6771build : .install-dev-stamp
72+ rm -rf build/ dist/
6873 venv/bin/python -m build
6974
70- upload-test : .install-dev-stamp build
75+ check-dist : build
76+ venv/bin/python -m twine check dist/*
77+ venv/bin/python scripts/check_distribution.py
78+
79+ upload-test : check-dist
7180 venv/bin/python -m twine upload --repository testpypi dist/*
7281
73- upload : .install-dev-stamp build
82+ upload : check-dist
7483 venv/bin/python -m twine upload dist/*
7584
76- all : clean format lint type-check test
85+ all : lint type-check coverage check-dist
0 commit comments