-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtasks.py
58 lines (42 loc) · 1.59 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
from invoke import task
@task
def build(c, version: str):
c.run(
f"cd vanilla_aiagents && python setup.py sdist bdist_wheel --version {version}"
)
@task
def test(c, test_path: str = "vanilla_aiagents/tests/", test_case: str = ""):
test_case_option = f"-k {test_case}" if test_case else ""
coverage_option = "--cov-append" if test_case else ""
# Run tests with coverage
c.run(
f"pytest --cov=vanilla_aiagents --cov-report=term-missing --cov-report=html {coverage_option} --cov-config=.coveragerc {test_case_option} {test_path}"
)
# Generate the combined coverage report
c.run("coverage html")
c.run("coverage xml")
c.run("python vanilla_aiagents/tests/generate_coverage_badge.py")
@task
def build_grpc(c):
proto_path = "vanilla_aiagents/vanilla_aiagents/remote"
proto_file = f"{proto_path}/remote.proto"
c.run(
f"python -m grpc_tools.protoc -I{proto_path} --python_out={proto_path} --grpc_python_out={proto_path} {proto_file}"
)
@task
def docs(c):
c.run(
"cd vanilla_aiagents && pdoc --output-dir docs -d markdown --logo https://raw.githubusercontent.com/Azure-Samples/vanilla-aiagents/main/logo.png vanilla_aiagents !vanilla_aiagents.remote.grpc"
)
@task
def check_lint(c):
c.run("cd vanilla_aiagents && flake8 vanilla_aiagents/")
@task
def check_docs(c):
c.run("cd vanilla_aiagents && pydocstyle vanilla_aiagents/")
@task
def lint(c):
c.run("cd vanilla_aiagents && black vanilla_aiagents/")
c.run(
"cd vanilla_aiagents && docformatter -i -r -s pep257 --black vanilla_aiagents/"
)