This directory contains the MkDocs documentation for GEPA.
Install the documentation dependencies using uv:
cd docs
uv pip install -r requirements.txtBefore building, generate the API reference pages:
uv run python scripts/generate_api_docs.pyThe script auto-generates documentation for all items in API_MAPPING, including:
- Core: optimize, GEPAAdapter, EvaluationBatch, GEPAResult, GEPACallback, DataLoader, GEPAState, EvaluationCache
- Callbacks: All event types (OptimizationStartEvent, IterationEndEvent, etc.) and CompositeCallback
- Stop Conditions: All stopper classes
- Adapters: DefaultAdapter, DSPyAdapter, RAGAdapter, MCPAdapter, etc.
- Proposers: CandidateProposal, ReflectiveMutationProposer, MergeProposer, etc.
- Logging: LoggerProtocol, StdOutLogger, Logger, ExperimentTracker, create_experiment_tracker
- Strategies: BatchSampler, CandidateSelector, ComponentSelector, EvaluationPolicy variants
To ensure all API items can be imported:
uv run python scripts/generate_api_docs.py --validateTo serve the documentation locally with live reloading:
uv run mkdocs serveThen visit http://localhost:8000
To build the static site:
uv run mkdocs buildThe output will be in the site/ directory.
docs/
├── docs/ # Documentation source files
│ ├── index.md # Home page
│ ├── api/ # Auto-generated API reference
│ │ ├── core/ # Core classes and functions
│ │ ├── callbacks/ # Callback system and events
│ │ ├── stop_conditions/# Stop condition classes
│ │ ├── adapters/ # Adapter implementations
│ │ ├── proposers/ # Proposer classes
│ │ ├── logging/ # Logging utilities
│ │ └── strategies/ # Strategy classes
│ ├── guides/ # User guides
│ │ ├── quickstart.md # Getting started guide
│ │ ├── adapters.md # Creating custom adapters
│ │ ├── callbacks.md # Using the callback system
│ │ └── contributing.md # Contributing guide
│ └── tutorials/ # Tutorial notebooks
├── scripts/
│ └── generate_api_docs.py # API doc generator (automated)
├── mkdocs.yml # MkDocs configuration
└── requirements.txt # Python dependencies
- Create a new
.mdfile indocs/guides/ - Add it to the
navsection inmkdocs.yml
- Copy the
.ipynbfile todocs/tutorials/ - Add it to the
navsection inmkdocs.yml
The API documentation is auto-generated from scripts/generate_api_docs.py:
- Add the new module/class to the
API_MAPPINGdictionary inscripts/generate_api_docs.py - Run
uv run python scripts/generate_api_docs.pyto regenerate all API docs - Add the new page to the
navsection inmkdocs.yml
Note: The API_MAPPING in generate_api_docs.py is the source of truth for API documentation.
The script auto-generates both the markdown files and the index content.
The generate_api_docs.py script provides several automation features:
| Command | Description |
|---|---|
python scripts/generate_api_docs.py |
Generate all API documentation |
python scripts/generate_api_docs.py --validate |
Validate all API imports work |
python scripts/generate_api_docs.py --print-nav |
Print nav structure for mkdocs.yml |
Social media previews are automatically generated for all key pages during CI builds. When users share links on Twitter, LinkedIn, Facebook, etc., they see beautiful preview cards.
- Local Development: No impact - script only runs in CI
- CI Build: After
mkdocs build, Playwright captures page screenshots at 1200×630px - Screenshot Updates: Script updates
og:imagetags in HTML to point to generated previews - Deploy: Screenshots are included in the deployed site
The following pages get automatic social preview screenshots:
| Page | Screenshot Path | Purpose |
|---|---|---|
| Home | /assets/social/home.png |
Main landing page preview |
| Showcase (Use Cases) | /assets/social/showcase.png |
Production use cases |
| About | /assets/social/about.png |
About GEPA |
| Blog Index | /assets/social/blog.png |
Blog feed |
| Guides | /assets/social/guides.png |
Documentation guides |
| API Docs | /assets/social/api.png |
API reference |
| Tutorials | /assets/social/tutorials.png |
Tutorial notebooks |
To provide a custom social preview image for a blog post or page, add OG meta tags to the frontmatter:
---
title: My Blog Post
meta:
- property: og:image
content: /blog/2026/02/18/my-post/custom-header.png
- name: twitter:image
content: /blog/2026/02/18/my-post/custom-header.png
---The script will skip updating OG tags for pages that already have custom images defined.
To include additional pages in screenshot generation, edit docs/scripts/generate_social_screenshots.py:
def get_pages_to_screenshot() -> list[tuple[str, str]]:
return [
# Add your page here
("site/path/to/page/index.html", "site/assets/social/page-name.png"),
]And update the og_updates dictionary:
og_updates = {
# Add corresponding update here
"path/to/page/index.html": "/assets/social/page-name.png",
}Location: docs/scripts/generate_social_screenshots.py
Environment Detection: Only runs in CI (CI environment variable must be set)
Dependencies:
playwright>=1.40.0- Browser automationpillow>=10.0.0- Image processing
Workflow Steps:
- Install Playwright browsers with system dependencies
- Render each configured page in a 1200×630px viewport
- Take screenshot and save to
/assets/social/ - Update OG image tags in HTML files to point to screenshots
Documentation is automatically built and deployed to GitHub Pages on push to main via GitHub Actions.
Staging deployments to Cloudflare Pages work identically - they also include social preview screenshots.
Build fails with import errors:
- Ensure all GEPA dependencies are installed
- Check that
src/gepais importable - Run
--validateto check specific imports
Pages not updating:
- Check the Actions tab for failed deployments
- Verify GitHub Pages is set to "GitHub Actions" source
Local build works but CI fails:
- CI installs from
pyproject.toml, not editable mode - Ensure all imports work without editable install
API docs out of sync with nav:
- Regenerate API docs:
python scripts/generate_api_docs.py - Validate the mapping:
python scripts/generate_api_docs.py --validate