Skip to content

Commit

Permalink
moved docs scripts to invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jan 7, 2025
1 parent a7fefb9 commit 22ddefd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
27 changes: 13 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,23 @@ test = [
"pytest-mock==3.14.0",
"coverage==7.6.9",
]
docs = [
"mkdocs==1.6.1",
"mkdocstrings[python]==0.27.0",
"mkdocs-material==9.5.44",
"pymdown-extensions==10.12",
"mkdocs-gen-files==0.5.0",
"mkdocs-literate-nav==0.6.1",
"mkdocs-include-markdown-plugin==7.1.2",
]
dev = [
"ipython==8.30.0",
"pre-commit==4.0.1",
"zimscraperlib[scripts]",
"zimscraperlib[lint]",
"zimscraperlib[test]",
"zimscraperlib[check]",
"zimscraperlib[docs]",
]

[project.scripts]
Expand Down Expand Up @@ -137,22 +147,11 @@ pyright = "inv check-pyright --args '{args}'"
all = "inv checkall --args '{args}'"

[tool.hatch.envs.docs]
template = "docs"
detached = true
dependencies = [
"mkdocs==1.6.1",
"mkdocstrings[python]==0.27.0",
"mkdocs-material==9.5.44",
"pymdown-extensions==10.12",
"mkdocs-gen-files==0.5.0",
"mkdocs-literate-nav==0.6.1",
"mkdocs-include-markdown-plugin==7.1.2",
"black==24.10.0",
]
features = ["scripts", "docs"]

[tool.hatch.envs.docs.scripts]
serve = "mkdocs serve"
build = "mkdocs build"
serve = "inv docs-serve --args '{args}'"
build = "inv docs-build --args '{args}'"

[tool.black]
line-length = 88
Expand Down
14 changes: 14 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,17 @@ def fixall(ctx: Context, args: str = "."):
fix_black(ctx, args)
fix_ruff(ctx, args)
lintall(ctx, args)


@task(optional=["args"], help={"args": "mkdocs build additional arguments"})
def docs_build(ctx: Context, args: str = ""):
"""build mkdocs documentation"""
args = args or "" # needed for hatch script
ctx.run(f"mkdocs build {args}", pty=use_pty)


@task(optional=["args"], help={"args": "mkdocs serve additional arguments"})
def docs_serve(ctx: Context, args: str = ""):
"""serve mkdocs documentation locally"""
args = args or "" # needed for hatch script
ctx.run(f"mkdocs serve {args}", pty=use_pty)

0 comments on commit 22ddefd

Please sign in to comment.