Skip to content

Commit

Permalink
Merge pull request #810 from pipecat-ai/mb/read-the-docs
Browse files Browse the repository at this point in the history
Changes for Read the Docs hosting
  • Loading branch information
markbackman authored Dec 10, 2024
2 parents e51e2f7 + 66b0816 commit 8c9c81d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
39 changes: 38 additions & 1 deletion docs/api/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Add source directory to path
docs_dir = Path(__file__).parent
project_root = docs_dir.parent
project_root = docs_dir.parent.parent
sys.path.insert(0, str(project_root / "src"))

# Project information
Expand Down Expand Up @@ -39,3 +39,40 @@
html_static_path = ["_static"]
autodoc_typehints = "description"
html_show_sphinx = False # Remove "Built with Sphinx"


def setup(app):
"""Generate API documentation during Sphinx build."""
from sphinx.ext.apidoc import main

docs_dir = Path(__file__).parent
project_root = docs_dir.parent.parent
output_dir = str(docs_dir / "api")
source_dir = str(project_root / "src" / "pipecat")

# Clean existing files
if Path(output_dir).exists():
import shutil

shutil.rmtree(output_dir)

print(f"Generating API documentation...")
print(f"Output directory: {output_dir}")
print(f"Source directory: {source_dir}")

# Similar exclusions as in your generate_docs.py
excludes = [
str(project_root / "src/pipecat/processors/gstreamer"),
str(project_root / "src/pipecat/transports/network"),
str(project_root / "src/pipecat/transports/services"),
str(project_root / "src/pipecat/transports/local"),
str(project_root / "src/pipecat/services/to_be_updated"),
"**/test_*.py",
"**/tests/*.py",
]

try:
main(["-f", "-e", "-M", "--no-toc", "-o", output_dir, source_dir] + excludes)
print("API documentation generated successfully!")
except Exception as e:
print(f"Error generating API documentation: {e}")
3 changes: 2 additions & 1 deletion docs/api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ sphinx>=8.1.3
sphinx-rtd-theme
sphinx-markdown-builder
sphinx-autodoc-typehints
toml
toml
pipecat-ai[anthropic,assemblyai,aws,azure,canonical,cartesia,deepgram,elevenlabs,fal,fireworks,gladia,google,grok,groq,krisp,langchain,lmnt,moondream,nim,noisereduce,openai,openpipe,playht,silero,soundfile,websocket,whisper]

0 comments on commit 8c9c81d

Please sign in to comment.