-
Notifications
You must be signed in to change notification settings - Fork 31
/
tasks.py
65 lines (45 loc) · 1.11 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
import glob
import os
import shutil
from invoke import task
import disba
@task
def build(c):
shutil.rmtree("dist", ignore_errors=True)
c.run("python -m build --sdist --wheel .")
@task
def tag(c):
c.run("git tag v{}".format(disba.__version__))
c.run("git push --tags")
@task
def upload(c):
c.run("twine upload dist/*")
@task
def clean(c, bytecode=False):
patterns = [
"build",
"dist",
"disba.egg-info",
]
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 py36 disba")
c.run("black -t py36 test")
@task
def docstring(c):
c.run("docformatter -r -i --blank --wrap-summaries 88 --wrap-descriptions 88 --pre-summary-newline disba")
@task
def isort(c):
c.run("isort disba")
c.run("isort test")
@task
def format(c):
c.run("invoke isort black docstring")