-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (78 loc) · 2.31 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
.PHONY: help test typecheck docs clean clean-test clean-pyc clean-build
.DEFAULT_GOAL := help
PACKAGE_NAME = requests_splash
VIRTUALENV ?= python -m venv
VIRTUAL_ENV ?= $(PWD)/.venv
PYTHON ?= $(VIRTUAL_ENV)/bin/python
PIP ?= $(VIRTUAL_ENV)/bin/pip
BROWSER ?= firefox
help:
@python make_help.py
$(PYTHON):
$(VIRTUALENV) $(VIRTUAL_ENV)
$(PIP) install "setuptools >= 30.3.0"
develop: $(PYTHON)
@## install the package in develop mode
$(PIP) install -e ".[testing]"
$(PIP) install -e ".[develop]"
$(PIP) install -e .
test:
@## run tests quickly with the default Python
$(PYTHON) -m unittest
typecheck:
@## check types with mypy
$(PYTHON) -m mypy $(PACKAGE_NAME)
lint:
@## check style with flake8
$(PYTHON) -m flake8 $(PACKAGE_NAME) tests
coverage:
@## show coverage in the console
$(PYTHON) -m coverage run -m unittest
$(PYTHON) -m coverage report -m
coverage-html:
@## show coverage in the browser
@## uses $BROWSER if present
$(PYTHON) -m coverage run -m unittest
$(PYTHON) -m coverage html
$(BROWSER) htmlcov/index.html
watch: COMMAND = $(MAKE) $(filter-out watch, $(MAKECMDGOALS))
watch:
@## Run make on source changes
@## Exemple: 'make watch test' will run make test on source changes
@ $(COMMAND) || exit 0
@ $(PYTHON) -m watchdog.watchmedo \
shell-command --patterns='*.py' \
--recursive \
--wait \
--command='$(COMMAND)'
docs:
@## generate Sphinx HTML documentation, including API docs
mkdir -p docs/_static
$(PYTHON) -m sphinx.apidoc --force -o docs/ requests_splash
$(MAKE) -C docs clean PYTHON=$(PYTHON)
$(MAKE) -C docs html PYTHON=$(PYTHON)
$(BROWSER) docs/_build/html/index.html
dist: clean
@## build source and wheel package
$(PYTHON) setup.py sdist
$(PYTHON) setup.py bdist_wheel
ls -l dist
clean: clean-build clean-pyc clean-test
@## remove all build, test, coverage and Python artifacts
clean-build:
@## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc:
@## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test:
@## remove test and coverage artifacts
rm -f .coverage
rm -fr htmlcov/
rm -fr .mypy_cache