-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtasks.py
121 lines (93 loc) · 2.5 KB
/
tasks.py
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import os
import webbrowser
from invoke import task
def open_browser(path):
try:
from urllib import pathname2url
except Exception:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(path)))
@task
def clean_build(c):
"""
Remove build artifacts
"""
c.run("rm -fr build/")
c.run("rm -fr dist/")
c.run("rm -fr *.egg-info")
@task
def clean_pyc(c):
"""
Remove python file artifacts
"""
c.run("find . -name '*.pyc' -exec rm -f {} +")
c.run("find . -name '*.pyo' -exec rm -f {} +")
c.run("find . -name '*~' -exec rm -f {} +")
@task
def coverage(c):
"""
check code coverage quickly with the default Python
"""
c.run("coverage run --source esignanywhere-python-client runtests.py tests")
c.run("coverage report -m")
c.run("coverage html")
c.run("open htmlcov/index.html")
@task
def docs(c):
"""
Build the documentation and open it in the browser
"""
c.run("rm -f docs/esignanywhere-python-client.rst")
c.run("rm -f docs/modules.rst")
c.run("sphinx-apidoc -o docs/ esignanywhere_python_client")
c.run("sphinx-build -E -b html docs docs/_build")
open_browser(path="docs/_build/html/index.html")
@task
def pip(c):
c.run("pip install -q -U pip~=20.3.0 pip-tools~=5.5.0")
c.run("pip-compile -q -U -o requirements_dev.txt requirements_dev.in")
c.run("pip-compile -q -U -o requirements_test.txt requirements_test.in")
@task
def test_all(c):
"""
Run tests on every python version with tox
"""
c.run("tox")
@task
def clean(c):
"""
Remove python file and build artifacts
"""
clean_build(c)
clean_pyc(c)
@task
def unittest(c):
"""
Run unittests
"""
c.run("python manage.py test")
@task
def lint(c):
"""
Check style with flake8
"""
c.run("flake8 esignanywhere-python-client tests")
@task(help={"bumpsize": 'Bump either for a "feature" or "breaking" change'})
def release(c, bumpsize=""):
"""
Package and upload a release
"""
clean(c)
if bumpsize:
bumpsize = "--" + bumpsize
c.run(f"bumpversion {bumpsize} --no-input")
import esignanywhere_python_client
c.run("python setup.py sdist bdist_wheel")
c.run("twine upload dist/*")
c.run(
'git tag -a {version} -m "New version: {version}"'.format(
version=esignanywhere_python_client.__version__
)
)
c.run("git push --tags")
c.run("git push origin master")