Skip to content

Commit 4c0841a

Browse files
committed
Add a typical Makefile
1 parent d093d5f commit 4c0841a

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
VENV_PYTHON:=venv/bin/python
2+
SRCS:=$(shell find src tests -name '*.py')
3+
4+
all: test
5+
6+
venv: requirements-test.in requirements.in
7+
rm -rf $@
8+
python -m venv venv
9+
$(VENV_PYTHON) -m pip install -r $^
10+
# Install dependencies from pyproject.toml
11+
$(VENV_PYTHON) -m pip install -e .
12+
13+
lint: venv .lint
14+
.lint: $(SRCS) $(TSCS)
15+
$(VENV_PYTHON) -m flake8 $?
16+
touch $@
17+
18+
static: venv .static
19+
.static: $(SRCS) $(TSCS)
20+
echo "Code: $(SRCS)"
21+
echo "Test: $(TSCS)"
22+
$(VENV_PYTHON) -m mypy $^
23+
touch $@
24+
25+
autopep8:
26+
autopep8 --in-place $(SRCS)
27+
28+
unit: venv
29+
$(VENV_PYTHON) -m pytest
30+
31+
test: lint static unit
32+
33+
clean:
34+
rm -rf .lint .static
35+
rm -rf .mypy_cache
36+
-find src -type d -name __pycache__ -exec rm -fr "{}" \;
37+
38+
force-clean: clean
39+
rm -rf venv

0 commit comments

Comments
 (0)