Automatic Documentation Generation
This pod leverages quartodoc and quarto to generate documentation directly from the codebase. This ensures seamless integration of documentation with the code and keeps it consistently up-to-date.
Prerequisites
Install Quarto
Ensure you have Quarto installed by following the instructions here.Configure Quartodoc
Quartodoc extracts docstrings from Python code and generates markdown files for documentation.
Steps to Enable Automatic Documentation
- Expose Functions or Classes for Quartodoc
Add functions or classes with docstrings to the
__all__
list in the package’s__init__.py
file.
For example, in the
__init__.py
file:= ["function_name", "ClassName"] __all__
- Include in Reference Documentation
- Update the
_quarto.yml
file at the project root to include the new items in thequartodoc
configuration.
- Under the
sections
key, specify the items you want in the reference documentation.
- Update the
- Pre-commit Hook for Auto-generation
- The
.pre_commit_config.yaml
file includes a hook that auto-generates documentation files before each commit. This ensures your documentation reflects the latest codebase.
- The
Manually Generating Documentation
To manually generate the documentation, run:
quartodoc build
The generated markdown files will be located in the reference
folder at the project root.
Viewing Documentation
View as Markdown
Navigate to thereference
folder and open the generated markdown files.View as a Website
Launch a local preview server by running:quarto preview
This opens the documentation in a browser as a website.
Additional Resources
For detailed guides on Quartodoc and Quarto, visit: