2021-04-02 13:49:40 +02:00
|
|
|
# =====CONFIG=====
|
2021-05-18 09:06:09 +02:00
|
|
|
PYTHON := python3
|
2021-04-02 13:49:40 +02:00
|
|
|
# This can't contain spaces (I think)
|
2021-05-18 08:57:40 +02:00
|
|
|
VENV := .venv
|
|
|
|
# Minimum % coverage for tests to succeed
|
2021-05-18 12:24:10 +02:00
|
|
|
MIN_COV := 0
|
2021-04-02 13:49:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
# By default, just create the venv when needed
|
|
|
|
all: venv
|
|
|
|
|
|
|
|
|
2021-05-18 08:57:40 +02:00
|
|
|
# =====RECIPES=====
|
|
|
|
## VENV
|
|
|
|
### Create the venv
|
|
|
|
$(VENV)/bin/activate: setup.py setup.cfg
|
2021-04-02 13:49:40 +02:00
|
|
|
@ '$(PYTHON)' -m venv '$(VENV)'
|
2021-05-18 08:57:40 +02:00
|
|
|
@ '$(VENV)'/bin/pip install -e .[develop]
|
2021-04-02 13:49:40 +02:00
|
|
|
|
2021-05-18 08:57:40 +02:00
|
|
|
|
|
|
|
### Convenient alias for the venv
|
2021-04-02 13:49:40 +02:00
|
|
|
venv: $(VENV)/bin/activate
|
|
|
|
.PHONY: venv
|
|
|
|
|
|
|
|
|
2021-05-18 08:57:40 +02:00
|
|
|
## Formatting & linting
|
2021-05-18 09:04:41 +02:00
|
|
|
### Format the codebase using black
|
2021-05-18 08:57:40 +02:00
|
|
|
format: venv
|
2021-05-18 09:04:41 +02:00
|
|
|
@ '$(VENV)'/bin/black setup.py app
|
2021-05-18 08:57:40 +02:00
|
|
|
.PHONY: format
|
|
|
|
|
2021-05-18 09:04:41 +02:00
|
|
|
### Lint using black & flake8
|
2021-05-18 08:57:40 +02:00
|
|
|
lint: venv
|
2021-05-18 09:04:41 +02:00
|
|
|
@ '$(VENV)'/bin/flake8 setup.py app
|
|
|
|
@ '$(VENV)'/bin/black --check setup.py app
|
2021-05-18 08:57:40 +02:00
|
|
|
.PHONY: lint
|
|
|
|
|
|
|
|
|
|
|
|
## Testing
|
|
|
|
test: venv
|
2021-05-18 09:04:41 +02:00
|
|
|
@ '$(VENV)'/bin/pytest --cov=app --cov-fail-under='$(MIN_COV)' tests/
|
2021-05-18 08:57:40 +02:00
|
|
|
.PHONY: test
|
|
|
|
|
|
|
|
|
|
|
|
## Cleaning
|
2021-04-02 13:49:40 +02:00
|
|
|
# Remove the venv
|
|
|
|
clean:
|
|
|
|
@ rm -rf '$(VENV)'
|
2021-05-18 08:57:40 +02:00
|
|
|
.PHONY: clean
|
2021-04-02 13:49:40 +02:00
|
|
|
|
|
|
|
|
2021-05-18 11:45:44 +02:00
|
|
|
## Starting the server
|
|
|
|
### Run the Quart server
|
2021-04-02 13:49:40 +02:00
|
|
|
run: venv
|
2021-05-18 11:45:44 +02:00
|
|
|
@ '$(VENV)'/bin/python app
|