forked from fmind/mlops-python-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.py
More file actions
34 lines (22 loc) · 863 Bytes
/
Copy pathdocs.py
File metadata and controls
34 lines (22 loc) · 863 Bytes
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
"""Docs tasks for pyinvoke."""
# %% IMPORTS
from invoke.context import Context
from invoke.tasks import task
from . import cleans
# %% CONFIGS
DOC_FORMAT = "google"
OUTPUT_DIR = "docs/"
# %% TASKS
@task
def serve(ctx: Context, format: str = DOC_FORMAT, port: int = 8088) -> None:
"""Serve the API docs with pdoc using the given format and computer port."""
ctx.run(f"poetry run pdoc --docformat={format} --port={port} src/{ctx.project.name}")
@task
def api(ctx: Context, format: str = DOC_FORMAT, output_dir: str = OUTPUT_DIR) -> None:
"""Document the API with pdoc using the given format and output directory."""
ctx.run(
f"poetry run pdoc --docformat={format} --output-directory={output_dir} src/{ctx.project.name}"
)
@task(pre=[cleans.docs, api], default=True)
def all(_: Context) -> None:
"""Run all docs tasks."""