ReadTheDocs Setup Guideο
This document explains how to set up and deploy the kicad-sch-api documentation on ReadTheDocs.
Whatβs Configuredο
The repository is fully configured for ReadTheDocs deployment:
Configuration Filesο
.readthedocs.yaml- ReadTheDocs build configurationPython 3.11 build environment
Installs
uvpackage managerUses
docs/conf.pyfor Sphinx configurationGenerates PDF and EPUB formats
docs/conf.py- Sphinx configurationSphinx RTD theme for professional styling
MyST parser for markdown support
Auto-generated API docs from docstrings
Napoleon extension for Google/NumPy style docstrings
docs/index.rst- Main documentation indexNavigation structure
Quick example and installation guide
Links to all documentation sections
docs/api/modules.rst- API reference structureAuto-generated from Python docstrings
Organized by module (collections, parsers, etc.)
Documentation Structureο
docs/
βββ conf.py # Sphinx configuration
βββ index.rst # Main index (entry point)
βββ api/
β βββ modules.rst # API reference
βββ _static/ # Static assets (images, CSS)
βββ _templates/ # Custom templates (if needed)
βββ README.md # Documentation index
βββ GETTING_STARTED.md # Beginner's guide
βββ WHY_USE_THIS_LIBRARY.md # Value proposition
βββ API_REFERENCE.md # Complete API docs
βββ RECIPES.md # Practical examples
βββ ARCHITECTURE.md # Internal design
Local Testingο
Build Documentation Locallyο
# Install docs dependencies
uv pip install -e ".[docs]"
# Build HTML documentation
cd docs
uv run sphinx-build -b html . _build/html
# View in browser
open _build/html/index.html # macOS
xdg-open _build/html/index.html # Linux
start _build/html/index.html # Windows
Build Other Formatsο
# PDF (requires LaTeX)
uv run sphinx-build -b latex . _build/latex
cd _build/latex && make
# EPUB
uv run sphinx-build -b epub . _build/epub
ReadTheDocs Deploymentο
Initial Setupο
Import Project on ReadTheDocs
Go to https://readthedocs.org/
Sign in with GitHub account
Click βImport a Projectβ
Select
circuit-synth/kicad-sch-api
Configure Project
Project will auto-detect
.readthedocs.yamlDefault branch:
mainDocumentation URL:
https://kicad-sch-api.readthedocs.io/
Build Settings (auto-configured via
.readthedocs.yaml)β Build documentation on every commit
β Build documentation on pull requests
β Generate PDF and EPUB downloads
Webhook Integrationο
ReadTheDocs automatically sets up GitHub webhooks to trigger builds on:
Pushes to
mainbranchNew tags/releases
Pull requests (for preview builds)
Custom Domain (Optional)ο
If you want to use a custom domain:
In ReadTheDocs Admin β Domains
Add custom domain (e.g.,
docs.circuit-synth.com)Add CNAME record in DNS pointing to
readthedocs.io
Adding New Documentationο
Adding Markdown Pagesο
Create new
.mdfile indocs/directoryAdd to
docs/index.rsttable of contents:
.. toctree::
:maxdepth: 2
:caption: Your Section
YOUR_NEW_FILE
Commit and push - ReadTheDocs will rebuild automatically
Adding New API Modulesο
New Python modules are auto-discovered if they have docstrings. To explicitly add:
Edit
docs/api/modules.rstAdd module reference:
New Module
~~~~~~~~~~
.. automodule:: kicad_sch_api.your.new.module
:members:
:undoc-members:
:show-inheritance:
Troubleshootingο
Build Failuresο
Check ReadTheDocs build logs:
Go to https://readthedocs.org/projects/kicad-sch-api/
Click βBuildsβ tab
View latest build log
Common issues:
Missing dependencies: Add to
pyproject.tomlunder[project.optional-dependencies.docs]Import errors: Ensure module can be imported in build environment
MyST errors: Check markdown syntax in
.mdfiles
Local Build Warningsο
Current build has ~28 warnings (mostly cross-reference anchors). These are cosmetic and donβt affect functionality.
To reduce warnings:
Fix internal cross-references in markdown files
Add explicit anchor targets with
(anchor-name)=syntax
Documentation Not Updatingο
If changes arenβt appearing:
Check ReadTheDocs build status
Clear browser cache
Trigger manual rebuild in ReadTheDocs dashboard
Version Managementο
ReadTheDocs automatically builds:
Latest: Development version from
mainbranchStable: Latest tagged release
Version-specific: Each tag creates a versioned build
Example URLs:
Latest:
https://kicad-sch-api.readthedocs.io/en/latest/Stable:
https://kicad-sch-api.readthedocs.io/en/stable/v0.4.0:
https://kicad-sch-api.readthedocs.io/en/v0.4.0/
Maintenanceο
Updating Sphinx Configurationο
Edit docs/conf.py to change:
Theme settings
Extension configuration
Project metadata
Updating ReadTheDocs Configurationο
Edit .readthedocs.yaml to change:
Python version
Build commands
Output formats
Monitoring Build Statusο
Add ReadTheDocs badge to README.md:
[](https://kicad-sch-api.readthedocs.io/en/latest/?badge=latest)
Resourcesο
Status: β Fully configured and ready for ReadTheDocs deployment Next Step: Import project on ReadTheDocs.org