-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
107 lines (78 loc) · 2.36 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import test
from invoke import Collection, task
@task
def format(c):
c.run(
"""
poetry install
poetry run ssort src tests dummy
poetry run isort -l 88 --up --tc --float-to-top src tests dummy
poetry run ruff --fix src tests dummy
poetry run black src tests dummy
cd fe; npx prettier --write --plugin prettier-plugin-svelte .
""",
pty=True,
)
@task
def edge(c):
c.run(
"""
edgedb-py --target async --file
edgedb-py --target blocking --no-skip-pydantic-validation --file
cp generated_async_edgeql.py src/wat/data/queries_async.py
cp generated_edgeql.py src/wat/data/queries_blocking.py
poetry install
python edge_model_gen.py
echo import pydantic > pd_import
cat pd_import generated_async_edgeql.py models.py > src/wat/data/queries_async.py && rm generated_async_edgeql.py
cat pd_import generated_edgeql.py models.py > src/wat/data/queries_blocking.py && rm generated_edgeql.py models.py
isort --float-to-top src/wat/data/queries_async.py src/wat/data/queries_blocking.py
python edge_dataclass_to_pydantic.py
black src/wat/data/queries_async.py src/wat/data/queries_blocking.py
rm pd_import
""" # noqa E501: line too long
)
@task
def edge_single(c):
c.run("edgedb-py --target async")
import glob
import edge_model_gen as emg
for file in glob.glob("queries/*async_edgeql.py"):
output = "\nimport pydantic\n"
output += emg.execute(file)
with open(file, "a") as f:
f.write(output)
c.run(
"""
poetry install
echo "\nssort\n"
poetry run ssort src tests dummy
echo "\nisort\n"
isort --float-to-top queries
echo "\nblack\n"
black queries/*.py
cp queries/*.py src/wat/queries
echo "\nruff\n"
poetry run ruff --fix src/wat/queries
""" # E501: line too long
)
@task
def dummy(c):
c.run("./start-dummy.sh", pty=True)
@task
def dev(c):
c.run("./start-dev.sh", pty=True)
@task
def redis(c):
c.run("docker compose up -d", pty=True)
@task
def worker(c):
redis(c)
c.run(
"cd src/wat && poetry run arq arq_main.WorkerSettings --watch .",
pty=True,
)
@task
def fe(c):
c.run("cd fe; npm run dev --host", pty=True)
namespace = Collection(format, edge, test, edge_single, dummy, dev, worker, fe)