-
Notifications
You must be signed in to change notification settings - Fork 0
/
duties.py
68 lines (49 loc) · 1.69 KB
/
duties.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
59
60
61
62
63
64
65
66
67
68
from __future__ import annotations
from duty import duty
@duty(capture=False)
def build(ctx, *args: str):
"""Build a MkNodes page."""
args_str = " " + " ".join(args) if args else ""
ctx.run(f"uv run mknodes build{args_str}")
@duty(capture=False)
def serve(ctx, *args: str):
"""Serve a MkNodes page."""
args_str = " " + " ".join(args) if args else ""
ctx.run(f"uv run mknodes serve{args_str}")
@duty(capture=False)
def test(ctx, *args: str):
"""Serve a MkNodes page."""
args_str = " " + " ".join(args) if args else ""
ctx.run(f"uv run pytest{args_str}")
@duty(capture=False)
def clean(ctx):
"""Clean all files from the Git directory except checked-in files."""
ctx.run("git clean -dfX")
@duty(capture=False)
def update(ctx):
"""Update all environment packages using pip directly."""
ctx.run("uv lock --upgrade")
ctx.run("uv sync --all-extras")
@duty(capture=False)
def lint(ctx):
"""Lint the code and fix issues if possible."""
ctx.run("uv run ruff check --fix .")
ctx.run("uv run ruff format .")
ctx.run("uv run mypy mkdocs_mknodes/")
@duty(capture=False)
def lint_check(ctx):
"""Lint the code."""
ctx.run("uv run ruff check .")
ctx.run("uv run ruff format --check .")
ctx.run("uv run mypy mkdocs_mknodes/")
@duty(capture=False)
def docs_test_build(ctx):
"""Build some test pages."""
ctx.run("uv run mknodes build -v")
opts = "-d ../site/mkdocs -p configs/mkdocs_mkdocs.yml -v --clone-depth 100"
ctx.run(f"uv run mknodes build {opts}")
@duty(capture=False)
def version(ctx, *args: str):
"""Bump package version."""
args_str = " " + " ".join(args) if args else ""
ctx.run(f"hatch version{args_str}")