| 1 | .PHONY: clean-pyc clean-build docs clean |
| 2 | BROWSER := python -mwebbrowser |
| 3 | |
| 4 | help: |
| 5 | @echo "clean - remove all build, test, coverage and Python artifacts" |
| 6 | @echo "clean-build - remove build artifacts" |
| 7 | @echo "clean-pyc - remove Python file artifacts" |
| 8 | @echo "clean-test - remove test and coverage artifacts" |
| 9 | @echo "lint - check style with flake8" |
| 10 | @echo "test - run tests quickly with the default Python" |
| 11 | @echo "test-all - run tests on every Python version with tox" |
| 12 | @echo "coverage - check code coverage quickly with the default Python" |
| 13 | @echo "docs - generate Sphinx HTML documentation, including API docs" |
| 14 | @echo "release - package and upload a release" |
| 15 | @echo "dist - package" |
| 16 | @echo "install - install the package to the active Python's site-packages" |
| 17 | @echo "develop - install the package in development mode" |
| 18 | @echo "update - Upgrade installed python packages and linting tools" |
| 19 | |
| 20 | clean: clean-build clean-pyc clean-test |
| 21 | |
| 22 | clean-build: |
| 23 | rm -fr build/ |
| 24 | rm -fr build-install/ |
| 25 | rm -fr dist/ |
| 26 | rm -fr .eggs/ |
| 27 | find . -name '*.egg-info' -exec rm -fr {} + |
| 28 | find . -name '*.egg' -exec rm -f {} + |
| 29 | |
| 30 | clean-pyc: |
| 31 | find . -name '*.pyc' -exec rm -f {} + |
| 32 | find . -name '*.pyo' -exec rm -f {} + |
| 33 | find . -name '*~' -exec rm -f {} + |
| 34 | find . -name '__pycache__' -exec rm -fr {} + |
| 35 | |
| 36 | clean-test: |
| 37 | rm -fr .tox/ |
| 38 | rm -f .coverage |
| 39 | rm -f coverage.xml |
| 40 | rm -fr htmlcov/ |
| 41 | |
| 42 | ruff: |
| 43 | ruff . $(args) |
| 44 | |
| 45 | ruff-isort: |
| 46 | ruff --select I001 --quiet . $(args) |
| 47 | |
| 48 | |
| 49 | lint: ruff ruff-isort |
| 50 | |
| 51 | lint-fix: |
| 52 | make lint args="--fix" |
| 53 | |
| 54 | build: |
| 55 | ./spin build |
| 56 | |
| 57 | test: clean-test |
| 58 | ./spin test |
| 59 | |
| 60 | coverage: |
| 61 | ./spin coverage |
| 62 | ./spin coverage-html |
| 63 | $(BROWSER) htmlcov/index.html |
| 64 | |
| 65 | docs: |
| 66 | ./spin docs |
| 67 | $(BROWSER) doc/_build/html/index.html |
| 68 | |
| 69 | sdist: clean-test |
| 70 | ./spin sdist |
| 71 | |
| 72 | dist: clean sdist wheel |
| 73 | python -m build |
| 74 | |
| 75 | develop: build |
| 76 | pip install --no-build-isolation . |
| 77 | |
| 78 | update: |
| 79 | pip list --outdated | cut -d ' ' -f1 | xargs -n1 pip install -U |
| 80 | pre-commit autoupdate |