Complete API documentation built with Sphinx and hosted on ReadTheDocs.
Install documentation dependencies:
pip install -r requirements.txtGenerate HTML documentation:
make htmlOpen in browser:
open _build/html/index.html # macOS
xdg-open _build/html/index.html # Linux
start _build/html/index.html # WindowsGenerate PDF documentation (requires LaTeX):
make pdfOutput: _build/pdf/GLPlot.pdf
Generate ePub eBook:
make epubRemove all build artifacts:
make cleandocs/
├── source/
│ ├── conf.py # Sphinx configuration
│ ├── index.rst # Main index page
│ ├── guide/ # User guides
│ │ ├── installation.rst
│ │ ├── quickstart.rst
│ │ ├── basic-plotting.rst
│ │ ├── 2d-plotting.rst
│ │ ├── 3d-visualization.rst
│ │ ├── advanced-features.rst
│ │ └── performance-tips.rst
│ ├── api/ # API reference (auto-generated)
│ │ ├── core.rst
│ │ ├── plotting.rst
│ │ ├── layers.rst
│ │ ├── managers.rst
│ │ └── utilities.rst
│ ├── dev/ # Developer guides
│ │ ├── contributing.rst
│ │ ├── architecture.rst
│ │ └── testing.rst
│ ├── gallery/
│ │ └── gallery.rst # Examples and gallery
│ └── _static/
│ └── custom.css # Custom styling
├── Makefile # Build automation
└── requirements.txt # Python dependencies
- Go to readthedocs.io
- Sign in with GitHub account
- Import repository
- Select
mainbranch - Build will start automatically
- Documentation will be published at:
https://glplot.readthedocs.io/
- On every push to
main→ docs rebuild automatically - PR previews available for documentation changes
- Builds take ~1-2 minutes
ReadTheDocs reads from:
.readthedocs.yml— Build settings, Python version, dependenciesdocs/conf.py— Sphinx settingsdocs/requirements.txt— Python packages needed
- Create
.rstfile indocs/source/guide/ - Add reference to
docs/source/index.rsttoctree - Build locally to verify:
make html - Commit and push
API docs are auto-generated from docstrings:
- Improve docstrings in
glplot/source code - Use Google-style format (configured via Napoleon)
- Include examples in docstrings
- Rebuild:
make html
Example docstring:
def plot(x, y, fmt=None, **kwargs):
"""Plot lines or markers and return the line objects.
This function creates a line plot with given data and optional
formatting.
Args:
x (array-like): X coordinates. Shape (N,).
y (array-like): Y coordinates. Shape (N,).
fmt (str, optional): Format string (e.g., 'r--', 'b-o').
Defaults to None.
**kwargs: Additional keyword arguments passed to plot styling.
Returns:
list: List of Layer objects added to plot.
Examples:
Plot a sine wave:
>>> import glplot as gplt
>>> import numpy as np
>>> x = np.linspace(0, 2*np.pi, 100)
>>> y = np.sin(x)
>>> gplt.plot(x, y, 'b-', label='sin(x)')
>>> gplt.show()
"""- Headings use
====for H1,----for H2,^^^^for H3 - Code blocks start with
.. code-block:: python - Cross-references:
:doc:`path/to/file`or:ref:`label` - Inline code:
backticks - External links:
`text <url>`_
- autodoc: Auto-generate API docs from docstrings
- autosummary: Summaries for functions/classes
- napoleon: Parse Google-style docstrings
- intersphinx: Link to NumPy/Matplotlib docs
- viewcode: Show source code links
- mathjax: Render math equations
Make sure glplot package is installed:
pip install -e .Check conf.py autodoc_default_options:
members: True— Include member functions/classesundoc-members: True— Include undocumented membersshow-inheritance: True— Show parent classes
Run with verbose output to see warnings:
make clean
make html SPHINXOPTS="-v"Check:
.readthedocs.ymlPython version matchespyproject.toml- All imports in
conf.pyare available inrequirements.txt - No syntax errors in RST files (run
sphinx-build -nfor nitpicky mode)
Changes auto-build when you push to GitHub. To manually trigger:
- Visit readthedocs.io dashboard
- Select GLPlot project
- Click "Build"
ReadTheDocs automatically builds:
latest— Most recent commit on main branchstable— Most recent tagged release- Pull request previews (for documentation branches)
- Created account at readthedocs.io
- Imported GLPlot repository
- Verified
.readthedocs.ymlin repo root - First build succeeded
- Documentation available at glplot.readthedocs.io
- Added link in README.md or GitHub repo description