-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
106 lines (85 loc) · 2.75 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
98
99
100
101
102
103
104
105
106
# This Makefile runs tests and builds the package to upload to pypi
# To use this Makefile, pip install py3make
# then do: pymake <command>
# or: python.exe -m pymake <command>
# You also need to pip install also other required modules: `pip install flake8 coverage twine pytest pytest-cov validate-pyproject[all] pytest-xdist rstcheck` , or simply `pip install --editable .[test,testmeta]`
#
# IMPORTANT: for compatibility with `python setup.py make [alias]`, ensure:
# 1. Every alias is preceded by @[+]make (eg: @make alias)
# 2. A maximum of one @make alias or command per line
#
# Sample makefile compatible with `python setup.py make`:
#```
#all:
# @make test
# @make install
#test:
# nosetest
#install:
# python setup.py install
#```
help:
@+make -p
alltests:
@+make testcoverage
@+make testsetup
all:
@make alltests
@make build
prebuildclean:
@+python -c "import shutil; shutil.rmtree('build', True)"
@+python -c "import shutil; shutil.rmtree('dist', True)"
@+python -c "import shutil; shutil.rmtree('fdict.egg-info', True)" # very important to delete egg-info before any new build or pip install, otherwise may cause an error that multiple egg-info folders are present, or it may build using old definitions
coverclean:
@+python -c "import os; os.remove('.coverage') if os.path.exists('.coverage') else None"
@+python -c "import shutil; shutil.rmtree('__pycache__', True)"
@+python -c "import shutil; shutil.rmtree('tests/__pycache__', True)"
test:
#tox --skip-missing-interpreters
pytest
testpyproject:
validate-pyproject pyproject.toml -v
testsetuppost:
twine check "dist/*"
testrst:
rstcheck README.rst
testcoverage:
@+make coverclean
coverage run --branch -m pytest -v
coverage report -m
testmalloc:
@+python -X dev -X tracemalloc=5 -m pytest
testasv:
asv run -j 8 HEAD~3..HEAD
@make viewasv
testasvfull:
asv run -j 8 v1.0.0..master
@make testasv
viewasv:
asv publish
asv preview
installdev:
@+make prebuildclean
# Should work for both Py2 and Py3, --editable option and isolation builds work with both pyproject.toml and setup.cfg
@+python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --upgrade --editable .[test,testmeta] --verbose --use-pep517
install:
@+make prebuildclean
@+python -m pip install --upgrade . --verbose --use-pep517
build:
# requires `pip install build`
@+make testrst
@+make prebuildclean
@+make testpyproject
@+python -sBm build # do NOT use the -w flag, otherwise only the wheel will be built, but we need sdist for source distros such as Debian and Gentoo!
@+make testsetuppost
buildwheelhouse:
cibuildwheel --platform auto
upload:
twine upload dist/*
buildupload:
@+make testsetup
@+make build
@+make pypimeta
@+make pypi
none:
# used for unit testing