-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
60 lines (46 loc) · 1.42 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
"""
#TODO: This file assumes that the developer uses a Linux environment and Pip.
# It should be updated to work with Conda and Windows.
This is an equivalent of Makefile that works both on Linux and Windows.
Check invoke documentation on http://www.pyinvoke.org.
It can be used to:
- build package
- build documentation
- serve documentation
"""
from invoke import task
@task
def clean(c, docs=True, extra=''):
patterns = ['build', 'dist']
if docs:
patterns.append('docs/build')
if extra:
patterns.append(extra)
for pattern in patterns:
print(pattern)
c.run(f"rm -Rf {pattern}")
@task
def build(c, docs=False):
c.run("python setup.py sdist bdist_wheel")
if docs:
c.run("cd docs && make html")
@task
def doc(c, port=8000):
c.run("cd doc && make html")
print("Build finished.")
print("=================================================================================")
print("Open your browser at 'http://localhost:" + str(port) + "' to browse the built " + \
"documentation.")
c.run(f"cd doc/build/html && python -m http.server {port}")
@task
def format(c):
c.run("black tsanalysis")
@task
def test(c):
c.run("pytest --cov-report term --cov=tsanalysis tests/")
@task
def lint(c):
c.run("pylint tsanalysis")
@task
def install(c):
c.run("pip install --user -e .[dev]")