66 lines
1.5 KiB
Makefile
66 lines
1.5 KiB
Makefile
.PHONY: clean clean/build clean/pyc help lint lint/flake8 lint/black lint/isort lint/type test
|
|
.DEFAULT_GOAL := help
|
|
|
|
define PRINT_HELP_PYSCRIPT
|
|
import re, sys
|
|
|
|
for line in sys.stdin:
|
|
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
|
|
if match:
|
|
target, help = match.groups()
|
|
print("%-20s %s" % (target, help))
|
|
endef
|
|
export PRINT_HELP_PYSCRIPT
|
|
|
|
|
|
help:
|
|
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|
|
|
|
clean: clean/build clean/pyc ## remove all build, test, coverage and Python artifacts
|
|
|
|
clean/build: ## remove build artifacts
|
|
rm -fr build/
|
|
rm -fr dist/
|
|
rm -fr .eggs/
|
|
find . -name '*.egg-info' -exec rm -fr {} +
|
|
find . -name '*.egg' -exec rm -f {} +
|
|
|
|
clean/pyc: ## remove Python file artifacts
|
|
find . -name '*.pyc' -exec rm -f {} +
|
|
find . -name '*.pyo' -exec rm -f {} +
|
|
find . -name '*~' -exec rm -f {} +
|
|
find . -name '__pycache__' -exec rm -fr {} +
|
|
find . -name '.pytest_cache' -exec rm -fr {} +
|
|
|
|
build/source:
|
|
python -m build --sdist
|
|
|
|
build/wheel:
|
|
python -m build --wheel
|
|
|
|
patch:
|
|
bump-my-version bump patch
|
|
|
|
minor:
|
|
bump-my-version bump minor
|
|
|
|
major:
|
|
bump-my-version bump major
|
|
|
|
release: clean build/source build/wheel
|
|
twine upload dist/*
|
|
|
|
lint/flake8: ## check style with flake8
|
|
flake8 src/api_client
|
|
lint/black: ## check style with black
|
|
black src/api_client
|
|
lint/isort: ## check imports with isort
|
|
isort src/api_client
|
|
lint/type: ## check imports with isort
|
|
mypy src/api_client
|
|
|
|
lint: lint/isort lint/black lint/flake8 lint/type ## check style
|
|
|
|
test: ## run tests quickly with the default Python
|
|
pytest -v
|