Doc
Document CLI.
Functions⚓︎
build ⚓︎
build(ctx)
Build documentation with Zensical.
Source code in calcipy/tasks/doc.py
@task()
def build(ctx: Context) -> None:
"""Build documentation with Zensical."""
write_template_formatted_sections()
_gen_reference(ctx)
run(ctx, f'{python_m()} zensical build')
deploy ⚓︎
deploy(ctx)
Deploy docs to the Github gh-pages branch.
Source code in calcipy/tasks/doc.py
@task()
def deploy(ctx: Context) -> None:
"""Deploy docs to the Github `gh-pages` branch."""
if _is_mkdocs_local(): # pragma: no cover
raise NotImplementedError('Not yet configured to deploy documentation without "use_directory_urls"')
with suppress(UnexpectedExit):
run(ctx, 'prek uninstall') # To prevent prek failures when the deploy pushes
run(ctx, f'{python_m()} ghp_import --no-jekyll --push --force --message "Deployed docs" {get_out_dir()}')
with suppress(UnexpectedExit):
run(ctx, 'prek install') # Restore prek
get_out_dir ⚓︎
get_out_dir()
Returns the mkdocs-specified site directory.
Source code in calcipy/tasks/doc.py
def get_out_dir() -> Path:
"""Returns the mkdocs-specified site directory."""
mkdocs_config = read_yaml_file(get_project_path() / MKDOCS_CONFIG)
return Path(mkdocs_config.get('site_dir', 'releases/site'))
watch ⚓︎
watch(ctx)
Serve local documentation for local editing.
Source code in calcipy/tasks/doc.py
@task()
def watch(ctx: Context) -> None:
"""Serve local documentation for local editing."""
if _is_mkdocs_local(): # pragma: no cover
path_doc_index = get_out_dir() / 'index.html'
open_in_browser(path_doc_index)
else: # pragma: no cover
webbrowser.open('http://localhost:8000')
_gen_reference(ctx)
run(ctx, f'{python_m()} zensical serve')