-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
37 lines (30 loc) · 1011 Bytes
/
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
# to create development environment: `make`
# to run pre-commit linting/formatting: `make lint`
VENVDIR=venv
VENVBIN=$(VENVDIR)/bin
VENVDONE=$(VENVDIR)/.done
help:
@echo Usage:
@echo "make install -- installs pre-commit hooks"
@echo "make lint -- runs pre-commit checks"
@echo "make clean -- remove pre-commit tools"
## run pre-commit checks on all files
lint: $(VENVDONE)
$(VENVBIN)/pre-commit run --all-files
# create venv with project dependencies
# --editable skips installing project sources in venv
# pre-commit is in dev optional-requirements
install $(VENVDONE): $(VENVDIR) Makefile pyproject.toml
$(VENVBIN)/python3 -m pip install --editable '.[dev]'
$(VENVBIN)/pre-commit install
touch $(VENVDONE)
$(VENVDIR):
python3 -m venv $(VENVDIR)
## update .pre-commit-config.yaml
update: $(VENVDONE)
$(VENVBIN)/pre-commit autoupdate
## clean up development environment
clean:
-$(VENVBIN)/pre-commit clean
rm -rf $(VENVDIR) build *.egg-info .pre-commit-run.sh.log \
__pycache__ .mypy_cache