2021-09-28    Share on: Twitter | Facebook | HackerNews | Reddit

Python - Project Documentation From the Code With Pdoc3

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