forked from rungalileo/galileo-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
59 lines (44 loc) · 1.48 KB
/
tasks.py
File metadata and controls
59 lines (44 loc) · 1.48 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
from platform import system
from invoke.context import Context
from invoke.tasks import task
# Disable `pty` on Windows to avoid issues with subprocesses.
# https://github.com/pyinvoke/invoke/issues/561
COMMON_PARAMS = {"echo": True, "pty": not system().lower().startswith("win")}
@task
def install(ctx: Context) -> None:
ctx.run("poetry install --all-extras --no-root", **COMMON_PARAMS)
@task
def setup(ctx: Context) -> None:
install(ctx)
ctx.run("poetry run pre-commit install --hook-type pre-commit", **COMMON_PARAMS)
@task
def test_report_xml(ctx: Context) -> None:
ctx.run("poetry run pytest -vvv --cov=galileo --cov-report=xml", **COMMON_PARAMS)
@task
def test(ctx: Context) -> None:
ctx.run("poetry run pytest --cov=galileo --cov-report=term-missing", **COMMON_PARAMS)
@task
def type_check(ctx: Context) -> None:
ctx.run(
"poetry run mypy --package galileo "
# TODO: remove as soon as mypy errors fixed
"--exclude galileo.resources "
"--exclude galileo.openai "
"--exclude galileo.decorator "
"--exclude galileo.handlers.langchain "
"--exclude galileo.log_streams "
"--exclude galileo.logger "
"--exclude galileo.api_client "
"--namespace-packages",
**COMMON_PARAMS,
)
@task
def poetry_lock(ctx: Context) -> None:
"""
Update poetry.lock file.
Parameters
----------
ctx : Context
Invoke context.
"""
ctx.run("poetry lock", **COMMON_PARAMS)