-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdodo.py
89 lines (62 loc) · 1.89 KB
/
dodo.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
import os
from hat import json
from pathlib import Path
import subprocess
DOIT_CONFIG = {"backend": "sqlite3", "verbosity": 2}
root_dir = Path(__file__).parent
os.environ["PYTHONPATH"] = ":".join([str(root_dir)])
def task_schemas_json():
"""Build JSON schema repositories"""
def run():
repo = json.SchemaRepository(Path("schemas_json/"))
json.encode_file(repo.to_json(), Path("aimm/json_schema_repo.json"))
return {"actions": [run]}
def task_test():
"""Run all tests"""
def run(args):
args = args or []
subprocess.run(
[
"python",
"-m",
"pytest",
"-s",
"-p",
"no:cacheprovider",
"--asyncio-mode",
"auto",
*args,
],
cwd="test",
check=True,
)
return {"actions": [run], "pos_arg": "args", "task_dep": ["schemas_json"]}
def task_lint():
"""Check linting"""
def run(args):
args = args or []
subprocess.run(
["flake8", "--exclude", "venv,node_modules,build", ".", *args]
)
return {"actions": [run], "pos_arg": "args"}
def task_format():
"""Format code"""
def run(args):
args = args or []
subprocess.run(["black", ".", "--line-length", "79", *args])
return {"actions": [run], "pos_arg": "args"}
def task_check():
"""Pre-deployment check"""
return {"actions": [], "task_dep": ["format", "lint"]}
def task_docs():
"""Build docs"""
def run(args):
args = args or []
subprocess.run(["sphinx-build", "docs", "build/docs", "-q", *args])
return {"actions": [run], "pos_arg": "args", "task_dep": ["schemas_json"]}
def task_dist():
"""Generate dist"""
return {
"actions": [["poetry", "build"]],
"task_dep": ["schemas_json"],
}