72 lines
2.2 KiB
Makefile
72 lines
2.2 KiB
Makefile
.PHONY: clean clean/build clean/pyc help lint lint/flake8 lint/black lint/isort lint/type test run-tasks run-app envs envs/generate-md envs/generate-yaml
|
|
.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 {} +
|
|
|
|
|
|
lint/flake8: ## check style with flake8
|
|
flake8 service
|
|
lint/black: ## check style with black
|
|
black service
|
|
lint/isort: ## check imports with isort
|
|
isort service
|
|
lint/type: ## check style with black
|
|
mypy service
|
|
lint: lint/isort lint/black lint/flake8 lint/type ## check style
|
|
|
|
|
|
test: ## run tests quickly with the default Python
|
|
pytest -v
|
|
|
|
|
|
docker-build:
|
|
docker build --progress plain --tag={{ cookiecutter.project_slug }}:latest .
|
|
docker-release:
|
|
docker build --tag={{ cookiecutter.project_slug }}:release .
|
|
docker-push: docker-build
|
|
docker push {{ cookiecutter.project_slug }}:latest
|
|
|
|
|
|
run-app:
|
|
exec uvicorn --reload --host 0.0.0.0 --port 8181 --proxy-headers --forwarded-allow-ips=* service.main:app
|
|
run-tasks:
|
|
exec dramatiq service.tasks --processes=1 --threads=2 --watch config --watch service
|
|
|
|
|
|
envs: envs/generate-md envs/generate-yaml
|
|
envs/generate-yaml:
|
|
#settings-doc generate --class service.config.ProjectSettings --output-format dotenv > example.env
|
|
settings-doc generate --class service.config.ProjectSettings --output-format dotenv --update example.env
|
|
envs/generate-md:
|
|
#settings-doc generate --class service.config.ProjectSettings --output-format markdown > ENVIRON.md
|
|
settings-doc generate --class service.config.ProjectSettings --output-format markdown --update ENVIRON.md
|