Postdoc enables you to create delightful documentation with ease.
The recommended way to install Postdoc is by running:
npm init postdoc@latestOr you can add Postdoc to an existing project manually:
npm i -D postdocand then run npx postdoc init to create a new Postdoc project.
Visit the official documentation.
Having trouble? Get help in the Discussions or create an issue.
| Package name | Package version |
|---|---|
| postdoc | 0.1.3 |
| create-postdoc | 0.0.1 |
Postdoc can handle sphinx documentation as well.
In your python project repository directory run the following CLI command:
sphinx-build -M xml ./docs/source ./docs/build/ -W --keep-goingImportant: You sould be able to generate sphinx docs before running postdoc init command.
On postdoc init command to handle the sphinx docs select the sphinx-python template and paste path to sphinx docs folder (where you have the Makefile and source folder).
? Select the UI template to used: sphinx-python
? Enter path to python sphinx docs: absolute/path/to/sphinx/docs
Something went wrong?
In case sphinx-build command failed, make sure the following applies to your python project as well.
Usually, setup for sphinx documentation has the following directory structure:
/docs: Main directory for Sphinx documentation. <---- we need this path!
/source: Your sphinx configuration and documentation in .md, .rst files.
conf.py: Config file for Sphinx
index.rst: Entrypoint for Sphinx docs (main page)
modules.rst: Lists the modules of your Python package.
/build: The output directory where Sphinx saves the generated documentation.
Makefile: A file with commands to build the docs in various formats.
/your_python_package: The directory containing your Python package code.
__init__.py: Indicates that this directory is a Python package.
module1.py: A module in your package.
module2.py: Another module in your package.
setup.py: The setup script for installing the package.
TIP: If you get some imports errors make sure in the conf.py you added this code at the top:
# conf.py
import sys
absPathToPyPackage = __file__.split("docs")[0]
sys.path.append(absPathToPyPackage)With that change sphinx will be able to get doc strings from python classes and functions.