Skip to content

Conversation

@TaXxER
Copy link
Contributor

@TaXxER TaXxER commented Dec 4, 2025

Add Sphinx Documentation Setup

Summary

This PR adds Sphinx-based API documentation for MCGrad, following the same pattern as the Ax repository. The project now uses a dual documentation system:

  1. Docusaurus (User Guide) - Hosted on GitHub Pages at https://facebookincubator.github.io/MCGrad/
  2. Sphinx (API Reference) - Ready for ReadTheDocs hosting at https://mcgrad.readthedocs.io/

This approach provides:

  • Auto-generated API docs from Python docstrings (no manual maintenance)
  • Professional documentation with type hints, cross-references, and search
  • Versioned documentation automatically built for each Git tag (via ReadTheDocs)

What Changed

New Files

  • sphinx/ - Complete Sphinx documentation setup

    • source/conf.py - Sphinx configuration with autodoc, Napoleon (Google-style docstrings), type hints
    • source/index.rst - Main documentation entry point
    • source/api/*.rst - Simple RST files for each module (using automodule directive)
    • Makefile - Build commands
    • requirements.txt - Sphinx dependencies
    • README.md - Documentation for working with Sphinx
  • .readthedocs.yaml - ReadTheDocs configuration (auto-detected when importing project)

  • scripts/test_docs.sh - Automated test script for both Sphinx and Docusaurus builds

  • DOCUMENTATION_TESTING.md - Comprehensive guide for testing and validating documentation

Modified Files

  • .github/workflows/main.yaml - Added sphinx job to build and validate Sphinx docs on every push

  • website/docusaurus.config.js - Added "API Reference" link in navbar pointing to ReadTheDocs

  • README.md - Updated documentation section to explain dual documentation system

  • .gitignore - Added Sphinx build artifacts (sphinx/build/, *.doctrees, .buildinfo)

Testing the Documentation

Quick Test (Both Systems)

Run the automated test script:

./scripts/test_docs.sh

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 4, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 4, 2025

@TaXxER has imported this pull request. If you are a Meta employee, you can view this in D88387259.

@TaXxER TaXxER closed this Dec 5, 2025
TaXxER added a commit that referenced this pull request Dec 5, 2025
Summary:
We're starting to see some "running out of disk space" errors on the machines that build Sphinx. We have plenty of budget, so let's just throw a bigger machine.

#18

Reviewed By: Lorenzo-Perini

Differential Revision: D88486737
@TaXxER TaXxER mentioned this pull request Dec 5, 2025
meta-codesync bot pushed a commit that referenced this pull request Dec 5, 2025
Summary:
Pull Request resolved: #24

We're starting to see some "running out of disk space" errors on the machines that build Sphinx. We have plenty of budget, so let's just throw a bigger machine.

#18

Reviewed By: Lorenzo-Perini

Differential Revision: D88486737

fbshipit-source-id: 3ab67c816a15a6d54bc330106e962b3e1f315e70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants