-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
46 lines (33 loc) · 1.02 KB
/
tasks.py
File metadata and controls
46 lines (33 loc) · 1.02 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
"""Realistic Python-library workflow: install / lint / typecheck / test / build."""
from ntask import cached, depends, shell, task
@task
def install():
"""Install dev dependencies (uncached - pip tracks its own state)."""
shell('pip install -e ".[dev]"')
@task
@cached(inputs=["src/**/*.py", "tests/**/*.py", "pyproject.toml"])
def lint():
"""Ruff - fast, idempotent, cache-friendly."""
shell("ruff check src tests")
@task
@cached(inputs=["src/**/*.py", "pyproject.toml"])
def typecheck():
"""Mypy against the library source."""
shell("mypy src")
@task
@cached(inputs=["src/**/*.py", "tests/**/*.py", "pyproject.toml"])
def test():
"""Pytest."""
shell("pytest -q")
@task
def check():
"""Fan-out: lint + typecheck + test. Run as `ntask check -j 3`."""
depends(lint, typecheck, test)
@task
@cached(
inputs=["src/**/*.py", "pyproject.toml", "README.md"],
outputs=["dist/"],
)
def build():
"""Build the wheel. Outputs listed so cache hits restore dist/."""
shell("python -m build")