|
24 | 24 | # Add local extensions to path |
25 | 25 | sys.path.insert(0, str(Path(__file__).parent / "_extensions")) |
26 | 26 |
|
| 27 | +# Add the project root to path so autodoc can import nemoguardrails |
| 28 | +sys.path.insert(0, str(Path(__file__).parent.parent)) |
| 29 | + |
27 | 30 | project = "NVIDIA NeMo Guardrails Library Developer Guide" |
28 | 31 | this_year = date.today().year |
29 | 32 | copyright = f"2023-{this_year}, NVIDIA Corporation" |
|
35 | 38 |
|
36 | 39 | extensions = [ |
37 | 40 | "myst_parser", |
| 41 | + "sphinx.ext.autodoc", |
| 42 | + "sphinx.ext.autosummary", |
| 43 | + "sphinx.ext.napoleon", |
| 44 | + "sphinx.ext.viewcode", |
38 | 45 | "sphinx.ext.intersphinx", |
| 46 | + "sphinx_autodoc_typehints", |
39 | 47 | "sphinx_copybutton", |
40 | 48 | "sphinx_reredirects", |
41 | 49 | "sphinx_design", |
|
44 | 52 | "search_assets", # Enhanced search assets extension |
45 | 53 | ] |
46 | 54 |
|
| 55 | +# -- Autodoc configuration --------------------------------------------------- |
| 56 | +autodoc_default_options = { |
| 57 | + "members": True, |
| 58 | + "undoc-members": False, |
| 59 | + "show-inheritance": True, |
| 60 | + "member-order": "bysource", |
| 61 | +} |
| 62 | +autodoc_typehints = "description" |
| 63 | +autodoc_class_signature = "separated" |
| 64 | + |
| 65 | +# Mock imports for optional dependencies that may not be installed |
| 66 | +autodoc_mock_imports = [ |
| 67 | + "presidio_analyzer", |
| 68 | + "presidio_anonymizer", |
| 69 | + "spacy", |
| 70 | + "google.cloud", |
| 71 | + "yara", |
| 72 | + "fast_langdetect", |
| 73 | + "opentelemetry", |
| 74 | + "streamlit", |
| 75 | + "tqdm", |
| 76 | +] |
| 77 | + |
| 78 | +# -- Autosummary configuration ----------------------------------------------- |
| 79 | +autosummary_generate = True |
| 80 | +autosummary_generate_overwrite = True |
| 81 | +autosummary_imported_members = True |
| 82 | + |
47 | 83 | redirects = { |
48 | 84 | "introduction": "index.html", |
49 | 85 | "documentation": "index.html", |
|
0 commit comments