-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
61 lines (44 loc) · 1.09 KB
/
Copy pathtasks.py
File metadata and controls
61 lines (44 loc) · 1.09 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
60
61
"""Invoke task definitions for project automation."""
from invoke import task
@task
def install(c):
"""Install project with dev dependencies."""
c.run("pip install -e '.[dev]'")
@task
def test(c, cov=True, mark=None):
"""Run tests."""
cmd = "pytest"
if cov:
cmd += " --cov=src/ai_project --cov-report=html"
if mark:
cmd += f" -m {mark}"
c.run(cmd)
@task
def format(c):
"""Format code with black."""
c.run("black src tests")
@task
def lint(c):
"""Lint code with ruff."""
c.run("ruff check src tests --fix")
@task
def type_check(c):
"""Type check with pyright."""
c.run("pyright src")
@task
def quality(c):
"""Run all quality checks."""
format(c)
lint(c)
type_check(c)
test(c)
@task
def pre_commit(c):
"""Install pre-commit hooks."""
c.run("pre-commit install")
@task
def clean(c):
"""Clean build artifacts."""
c.run("rm -rf build dist *.egg-info .pytest_cache .coverage htmlcov")
c.run("find . -type d -name __pycache__ -exec rm -rf {} +")
c.run("find . -type f -name '*.pyc' -delete")