Skip to content

Commit 57d9e58

Browse files
committed
feat(docs): add Sphinx configuration and index for API documentation
1 parent 0375263 commit 57d9e58

3 files changed

Lines changed: 74 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ instance/
7373
.scrapy
7474

7575
# Sphinx documentation
76-
docs/_build/
76+
docs/build/
77+
docs/api/
78+
7779

7880
# PyBuilder
7981
.pybuilder/

docs/conf.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import os
2+
import sys
3+
4+
# Allow autodoc to import the sinch package from the project root
5+
sys.path.insert(0, os.path.abspath(".."))
6+
from sinch import __version__
7+
8+
# -- Project information -------------------------------------------------------
9+
10+
project = "Sinch Python SDK"
11+
copyright = "2024, Sinch Developer Experience Team"
12+
author = "Sinch Developer Experience Team"
13+
release = __version__
14+
15+
# -- General configuration -----------------------------------------------------
16+
17+
extensions = [
18+
# Automatically generates .rst files from Python source (replaces running
19+
# sphinx-apidoc manually — configured via apidoc_modules below)
20+
"sphinx.ext.apidoc",
21+
# Pulls docstrings from Python source into the generated .rst files
22+
"sphinx.ext.autodoc",
23+
# Adds [source] links that open the highlighted source file
24+
"sphinx.ext.viewcode",
25+
]
26+
27+
# -- sphinx.ext.apidoc ---------------------------------------------------------
28+
# Runs apidoc automatically during the build — no need for a separate command.
29+
# Each entry in the list corresponds to one package to document.
30+
31+
apidoc_modules = [
32+
{
33+
# Path to the Python package, relative to this conf.py file
34+
"path": "../sinch",
35+
# Output directory for the generated .rst files, relative to the docs source dir
36+
"destination": "api",
37+
}
38+
]
39+
40+
# -- sphinx.ext.autodoc --------------------------------------------------------
41+
42+
autodoc_default_options = {
43+
# Document all public members (methods, attributes, nested classes)
44+
"members": True,
45+
# Show the class inheritance chain
46+
"show-inheritance": True,
47+
# Preserve the order in which members appear in the source file
48+
"member-order": "bysource",
49+
}
50+
51+
# Render type hints as part of the parameter/return descriptions, not the signature
52+
autodoc_typehints = "both"
53+
54+
# -- HTML output ---------------------------------------------------------------
55+
56+
html_theme = "sphinx_rtd_theme"
57+
58+
html_theme_options = {
59+
# Maximum depth of the navigation sidebar (-1 = unlimited)
60+
"navigation_depth": -1,
61+
# Keep all navigation entries expanded by default
62+
"collapse_navigation": False,
63+
}

docs/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Sinch Python SDK
2+
================
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
:caption: API Reference
7+
8+
api/modules

0 commit comments

Comments
 (0)