-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
53 lines (39 loc) · 1.44 KB
/
Copy pathtasks.py
File metadata and controls
53 lines (39 loc) · 1.44 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
import os
from invoke import Context, task
WINDOWS = os.name == "nt"
PROJECT_NAME = "anomaly_detection"
PYTHON_VERSION = "3.13"
# Project commands
@task
def preprocess_data(ctx: Context) -> None:
"""Preprocess data."""
ctx.run(f"uv run src/{PROJECT_NAME}/data.py data/raw data/processed", echo=True, pty=not WINDOWS)
@task
def train(ctx: Context) -> None:
"""Train model."""
ctx.run(f"uv run src/{PROJECT_NAME}/train.py", echo=True, pty=not WINDOWS)
@task
def test(ctx: Context) -> None:
"""Run tests."""
ctx.run("uv run coverage run -m pytest tests/", echo=True, pty=not WINDOWS)
ctx.run("uv run coverage report -m -i", echo=True, pty=not WINDOWS)
@task
def docker_build(ctx: Context, progress: str = "plain") -> None:
"""Build docker images."""
ctx.run(
f"docker build -t train:latest . -f dockerfiles/train.dockerfile --progress={progress}",
echo=True,
pty=not WINDOWS,
)
ctx.run(
f"docker build -t api:latest . -f dockerfiles/api.dockerfile --progress={progress}", echo=True, pty=not WINDOWS
)
# Documentation commands
@task
def build_docs(ctx: Context) -> None:
"""Build documentation."""
ctx.run("uv run mkdocs build --config-file docs/mkdocs.yaml --site-dir build", echo=True, pty=not WINDOWS)
@task
def serve_docs(ctx: Context) -> None:
"""Serve documentation."""
ctx.run("uv run mkdocs serve --config-file docs/mkdocs.yaml", echo=True, pty=not WINDOWS)