-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (39 loc) · 1.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.PHONY: help bootstrap lint test requirements
VENV?=.venv
PYTHON?=python3
help:
@echo
@echo "make install -- setup production environment"
@echo
@echo "make development -- setup development environment"
@echo "make test -- run full test suite"
@echo "make lint -- run all linters on the code base"
@echo
@echo "make requirements -- only compile the requirements*.txt files"
@echo "make .venv -- bootstrap the virtualenv."
@echo
install: $(VENV)/.pip-installed-production
development: $(VENV)/.pip-installed-development .git/hooks/pre-commit
lint: development
$(VENV)/bin/pre-commit run -a
test: development
$(VENV)/bin/pytest
requirements: requirements.txt requirements-dev.txt
requirements.txt: pyproject.toml
$(VENV)/bin/pip-compile -v --output-file=$@ $<
requirements-dev.txt: pyproject.toml
$(VENV)/bin/pip-compile -v --output-file=$@ --extra=dev $<
# Actual files/directories
################################################################################
# Create this directory as a symbolic link to an existing virtualenv, if you want to use that.
$(VENV):
$(PYTHON) -m venv --system-site-packages $(VENV)
$(VENV)/bin/pip install pip-tools wheel
touch $(VENV)
$(VENV)/.pip-installed-production: $(VENV) requirements.txt
$(VENV)/bin/pip-sync requirements.txt && touch $@
$(VENV)/.pip-installed-development: $(VENV) requirements-dev.txt
$(VENV)/bin/pip-sync requirements-dev.txt && touch $@
.git/hooks/pre-commit: $(VENV)
$(VENV)/bin/pre-commit install
touch .git/hooks/pre-commit