-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (54 loc) · 1.44 KB
/
Makefile
File metadata and controls
69 lines (54 loc) · 1.44 KB
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
# Automate pip package development
#
# Usage
# To release a package.
# - update version in serpapi/_version.py
# - review README version
# - run
# $ make release
# current version
version=$(shell grep version setup.py | cut -d"'" -f2)
dist=dist/serpapi-$(version).tar.gz
.PHONY: build
all: clean install readme doc lint test build oobt check
clean:
find . -name '*.pyc' -delete
find . -type d -name "__pycache__" -delete
python3 -m pip uninstall serpapi
# lint check
lint:
python3 -m pylint serpapi
# test with Python 3
test:
python3 -mpytest --cov=serpapi --cov-report html tests/*.py
# install dependencies
#
# pytest-cov - code coverage extension for pytest
# sphinx - documentation
# twine - release automation
install:
python3 -m pip install -U setuptools
python3 -m pip install -r requirements.txt
python3 -m pip install pylint
python3 -m pip install pytest-cov
python3 -m pip install twine
python3 -m pip install sphinx
readme:
erb -T '-' README.md.erb > README.md
doc: readme
$(MAKE) -C docs/ html
# https://packaging.python.org/tutorials/packaging-projects/
build:
python3 setup.py sdist
# out of box testing / user acceptance before delivery
oobt: build
python3 -m pip install ./${dist}
python3 oobt/demo.py
check: oobt
python3 -m twine check ${dist}
release: # check
python3 -m twine upload ${dist}
# run example only
# and display output (-s)
example:
python3 -m pytest -s "tests/test_example.py::TestExample::test_async"