2021-09-28

Python - Project Documentation From the Code With Pdoc3

X::[[sphinx_for_documentation]] X::[[docusaurus_for_documentation]] X::[[mkdocs_material]] X::[[pdoc3_documentation_dir]]

Despite Sphinx seems to be the most common tool for generating documentation, the pdoc3 is an interesting option.

Generate html documentation:

pdoc --force --html --output-dir ./doc_myproject myproject

where --force will overwrite any existing generated (--output-dir) files.

Generate html documentation and open in browser:

pdoc --force --html --output-dir ./doc_myproject myproject && xdg-open ./doc_myproject/myproject/index.html

I used to add these two documentation-related targets to the project's Makefile:

## Generate pdoc HTML documentation for prolog package
doc:
 pdoc --force --html --output-dir ./doc_myproject myproject

## Generate pdoc HTML documentation for prolog package and open in browser
doc_view:
 pdoc --force --html --output-dir ./doc_myproject myproject && xdg-open ./doc_myproject/myproject/index.html

alternatives

X::[[project_documentation_tool_alternatives]]