-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
84 lines (69 loc) · 1.65 KB
/
tasks.py
File metadata and controls
84 lines (69 loc) · 1.65 KB
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
"""
author: prashant.srivastav
"""
import invoke
@invoke.task
def lint(ctx):
"""Run linter."""
ctx.run("pre-commit run --all-files --show-diff-on-failure")
@invoke.task
def requirements(ctx):
"""Generate requirements.txt"""
reqs = [
"pipenv requirements > requirements.txt",
"pipenv requirements --dev-only > requirements-dev.txt",
]
[ctx.run(req) for req in reqs]
@invoke.task
def test(ctx):
"""Run pytest tests."""
ctx.run(
" ".join(
[
"pytest",
"-v",
"-s",
"--cov-report term",
"--cov-report xml",
"--cov=rapida",
"--asyncio-mode=auto",
],
),
)
@invoke.task
def analyze(ctx):
"""Run mypy."""
ctx.run(
" ".join(
[
"mypy",
"rapida",
"--exclude=artifacts",
"--ignore-missing-imports",
"--cache-dir=/dev/null",
],
),
)
@invoke.task
def git(ctx):
"""Run to set up git hooks"""
ctx.run("chmod +x bin/git-commit-hook-setup.sh")
ctx.run("sh bin/git-commit-hook-setup.sh")
# pre-commit installed hook for lint
ctx.run("pre-commit install")
@invoke.task
def setup(ctx):
# setup git hooks for commit
git(ctx)
requirements(ctx)
@invoke.task
def package(ctx):
"""Create the python packages"""
# generate requirements.txt from pipenv requirements
requirements(ctx)
# linting
lint(ctx)
# type checking mypy
# analyze(ctx)
# packaging
ctx.run("python setup.py sdist bdist_wheel")