-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (38 loc) · 1.41 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
# from rss-fetcher
# from mc-providers (removed make test), from es-tools, from sitemap-tools
# 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, dev environment"
@echo "make lint -- runs pre-commit checks"
@echo "make requirements -- make requirements.txt"
@echo "make update -- update .pre-commit-config.yaml"
@echo "make clean -- remove development environment"
## 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
## build requirements.txt (required by Heroku buildpack?)
requirements: $(VENVDONE)
$(VENVBIN)/pip-compile -o requirements.txt.tmp --strip-extras pyproject.toml
mv requirements.txt.tmp requirements.txt
## clean up development environment
clean:
-$(VENVBIN)/pre-commit clean
rm -rf $(VENVDIR) build *.egg-info .pre-commit-run.sh.log \
__pycache__ .mypy_cache