-
Notifications
You must be signed in to change notification settings - Fork 1
/
tasks.py
72 lines (50 loc) · 1.24 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
import glob
import os
import shutil
from invoke import task
import bruces
@task
def build(c):
shutil.rmtree("dist", ignore_errors=True)
c.run("python -m build --sdist --wheel .")
@task
def html(c):
c.run("sphinx-build -b html doc/source doc/build")
@task
def tag(c):
c.run("git tag v{}".format(bruces.__version__))
c.run("git push --tags")
@task
def upload(c):
c.run("twine upload dist/*")
@task
def clean(c, bytecode=False):
patterns = [
"build",
"dist",
"bruces.egg-info",
"doc/build",
"doc/source/examples",
]
if bytecode:
patterns += glob.glob("**/*.pyc", recursive=True)
patterns += glob.glob("**/__pycache__", recursive=True)
for pattern in patterns:
if os.path.isfile(pattern):
os.remove(pattern)
else:
shutil.rmtree(pattern, ignore_errors=True)
@task
def black(c):
c.run("black -t py38 bruces")
c.run("black -t py38 tests")
@task
def docstring(c):
c.run("docformatter -r -i --blank --wrap-summaries 88 --wrap-descriptions 88 --pre-summary-newline bruces")
@task
def isort(c):
c.run("isort bruces")
c.run("isort tests")
@task
def format(c):
c.run("invoke isort black docstring")