forked from psf/requests-html
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (65 loc) · 1.8 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
APP_NAME=.
REQUIREMENTS_FILE=requirements.txt
.PHONY: env
env:
# check ENV env var has been set
ifndef ENV
$(error Must set ENV variable!)
endif
# load env vars from .env file if present
ifneq ("$(wildcard $(ENV).env)", "")
@echo "Loading configuration from $(ENV).env"
# include cannot be indented
include $(ENV).env
else
@echo "Continuing without .env file."
@echo "Creating template $(ENV).env file"
endif
.PHONY: setup
setup:
@echo sets up the development environment
python3 -m venv venv
@echo activate venv with 'source venv/bin/activate'
.PHONY: requirements
requirements: env
pip install -r $(APP_NAME)/$(REQUIREMENTS_FILE)
# only install dependencies locally if in dev env
ifeq ($(ENV), dev)
echo "install dev dependencies"
pip install -e .[dev]
else
echo "installing minimal $(ENV) dependencies"
pip install -e .
endif
playwright install
.PHONY: update-requirements
update-requirements: env
pip freeze --exclude-editable | xargs pip uninstall -y
rm $(APP_NAME)/$(REQUIREMENTS_FILE) || true
pip install -r $(APP_NAME)/requirements.txt.blank
pip freeze --exclude-editable > $(APP_NAME)/$(REQUIREMENTS_FILE)
documentation:
cd docs && make html
cd docs/build/html && git add -A && git commit -m 'updates'
cd docs/build/html && git push origin gh-pages
# documentation targets
.PHONY: docs-lint
docs-lint:
@echo linting files at docs/**/*.md
markdownlint docs/**/*.md
.PHONY: docs-serve
docs-serve:
@echo serving the site on http://localhost:8000
mkdocs serve
.PHONY: docs-build
docs-build:
@echo building the site
mkdocs build --strict --verbose --site-dir public
.PHONY: lint
lint:
black $(APP_NAME)/.
black tests
test:
python -m pytest tests -v
test-reports:
python -m pytest --doctest-modules --junitxml=junit/test-results.xml --cov=requests-html --cov-report=xml --cov-report=html tests -v