|
| 1 | +# Configuration file for the Sphinx documentation builder. |
| 2 | +# |
| 3 | +# For the full list of built-in configuration values, see the documentation: |
| 4 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html |
| 5 | + |
| 6 | +import os |
| 7 | +import sys |
| 8 | +from unittest.mock import MagicMock |
| 9 | + |
| 10 | +# Add the project root to the Python path |
| 11 | +sys.path.insert(0, os.path.abspath('../../')) |
| 12 | + |
| 13 | +# Mock dependencies that may not be available during doc builds |
| 14 | +autodoc_mock_imports = [ |
| 15 | + 'torch', |
| 16 | + 'torch.nn', |
| 17 | + 'torch.nn.functional', |
| 18 | + 'torch.optim', |
| 19 | + 'torch.utils', |
| 20 | + 'torch.utils.data', |
| 21 | + 'torchvision', |
| 22 | + 'transformers', |
| 23 | + 'datasets', |
| 24 | + 'wandb', |
| 25 | + 'tensorboard', |
| 26 | + 'matplotlib', |
| 27 | + 'matplotlib.pyplot', |
| 28 | + 'seaborn', |
| 29 | + 'numpy', |
| 30 | + 'pandas', |
| 31 | + 'scipy', |
| 32 | + 'sklearn', |
| 33 | + 'scikit-learn', |
| 34 | + 'tqdm', |
| 35 | + 'yaml', |
| 36 | + 'pyyaml', |
| 37 | + 'omegaconf', |
| 38 | + 'huggingface_hub', |
| 39 | + 'safetensors' |
| 40 | +] |
| 41 | + |
| 42 | +# More robust mocking for Read the Docs |
| 43 | +class Mock(MagicMock): |
| 44 | + @classmethod |
| 45 | + def __getattr__(cls, name): |
| 46 | + return MagicMock() |
| 47 | + |
| 48 | +for mod_name in autodoc_mock_imports: |
| 49 | + sys.modules[mod_name] = Mock() |
| 50 | + |
| 51 | +# -- Project information ----------------------------------------------------- |
| 52 | +project = 'JEPA Framework' |
| 53 | +copyright = '2025, Dilip Venkatesh' |
| 54 | +author = 'Dilip Venkatesh' |
| 55 | +release = '0.1.0' |
| 56 | +version = '0.1.0' |
| 57 | + |
| 58 | +# -- General configuration --------------------------------------------------- |
| 59 | +extensions = [ |
| 60 | + 'sphinx.ext.autodoc', |
| 61 | + 'sphinx.ext.autosummary', |
| 62 | + 'sphinx.ext.viewcode', |
| 63 | + 'sphinx.ext.napoleon', |
| 64 | + 'sphinx.ext.intersphinx', |
| 65 | + 'sphinx.ext.mathjax', |
| 66 | + 'myst_parser', |
| 67 | + 'sphinx_copybutton', |
| 68 | +] |
| 69 | + |
| 70 | +# Only add optional extensions if available |
| 71 | +try: |
| 72 | + import sphinx_design |
| 73 | + extensions.append('sphinx_design') |
| 74 | +except ImportError: |
| 75 | + pass |
| 76 | + |
| 77 | +try: |
| 78 | + import sphinxcontrib.mermaid |
| 79 | + extensions.append('sphinxcontrib.mermaid') |
| 80 | +except ImportError: |
| 81 | + pass |
| 82 | + |
| 83 | +# MyST-Parser Configuration |
| 84 | +source_suffix = { |
| 85 | + '.rst': None, |
| 86 | + '.md': None, |
| 87 | +} |
| 88 | + |
| 89 | +myst_enable_extensions = [ |
| 90 | + "colon_fence", |
| 91 | + "deflist", |
| 92 | + "html_admonition", |
| 93 | + "html_image", |
| 94 | + "replacements", |
| 95 | + "smartquotes", |
| 96 | + "substitution", |
| 97 | + "tasklist", |
| 98 | +] |
| 99 | + |
| 100 | +# Template and exclusion configuration |
| 101 | +templates_path = ['_templates'] |
| 102 | +exclude_patterns = [] |
| 103 | + |
| 104 | +# -- Options for HTML output ------------------------------------------------- |
| 105 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
| 106 | + |
| 107 | +html_theme = 'sphinx_rtd_theme' |
| 108 | +html_static_path = ['_static'] |
| 109 | + |
| 110 | +# -- Extension configuration ------------------------------------------------- |
| 111 | + |
| 112 | +# Napoleon settings |
| 113 | +napoleon_google_docstring = True |
| 114 | +napoleon_numpy_docstring = True |
| 115 | +napoleon_include_init_with_doc = False |
| 116 | +napoleon_include_private_with_doc = False |
| 117 | +napoleon_include_special_with_doc = True |
| 118 | +napoleon_use_admonition_for_examples = False |
| 119 | +napoleon_use_admonition_for_notes = False |
| 120 | +napoleon_use_admonition_for_references = False |
| 121 | +napoleon_use_ivar = False |
| 122 | +napoleon_use_param = True |
| 123 | +napoleon_use_rtype = True |
| 124 | +napoleon_preprocess_types = False |
| 125 | +napoleon_type_aliases = None |
| 126 | +napoleon_attr_annotations = True |
| 127 | + |
| 128 | +# Autodoc settings |
| 129 | +autodoc_default_options = { |
| 130 | + 'members': True, |
| 131 | + 'member-order': 'bysource', |
| 132 | + 'special-members': '__init__', |
| 133 | + 'undoc-members': True, |
| 134 | + 'exclude-members': '__weakref__' |
| 135 | +} |
| 136 | + |
| 137 | +# Autosummary settings |
| 138 | +autosummary_generate = True |
| 139 | + |
| 140 | +# MyST settings |
| 141 | +myst_enable_extensions = [ |
| 142 | + "colon_fence", |
| 143 | + "deflist", |
| 144 | + "dollarmath", |
| 145 | + "fieldlist", |
| 146 | + "html_admonition", |
| 147 | + "html_image", |
| 148 | + "replacements", |
| 149 | + "smartquotes", |
| 150 | + "strikethrough", |
| 151 | + "substitution", |
| 152 | + "tasklist", |
| 153 | +] |
| 154 | + |
| 155 | +# Intersphinx settings |
| 156 | +intersphinx_mapping = { |
| 157 | + 'python': ('https://docs.python.org/3/', None), |
| 158 | + 'torch': ('https://pytorch.org/docs/stable/', None), |
| 159 | + 'numpy': ('https://numpy.org/doc/stable/', None), |
| 160 | +} |
| 161 | + |
| 162 | +# HTML theme options |
| 163 | +html_theme_options = { |
| 164 | + 'collapse_navigation': False, |
| 165 | + 'sticky_navigation': True, |
| 166 | + 'navigation_depth': 4, |
| 167 | + 'includehidden': True, |
| 168 | + 'titles_only': False, |
| 169 | + 'logo_only': False, |
| 170 | + 'display_version': True, |
| 171 | + 'prev_next_buttons_location': 'bottom', |
| 172 | + 'style_external_links': False, |
| 173 | + 'style_nav_header_background': '#2980B9', |
| 174 | +} |
| 175 | + |
| 176 | +# Custom CSS |
| 177 | +html_css_files = [ |
| 178 | + 'custom.css', |
| 179 | +] |
| 180 | + |
| 181 | +# Logo (commented out until logo is available) |
| 182 | +# html_logo = '_static/logo.png' |
| 183 | + |
| 184 | +# Sidebar |
| 185 | +html_sidebars = { |
| 186 | + '**': [ |
| 187 | + 'relations.html', # needs 'show_related': True theme option to display |
| 188 | + 'searchbox.html', |
| 189 | + ] |
| 190 | +} |
| 191 | + |
| 192 | +# Copy button configuration |
| 193 | +copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " |
| 194 | +copybutton_prompt_is_regexp = True |
| 195 | + |
| 196 | +# Source suffix (configured earlier) |
| 197 | +# source_suffix = { |
| 198 | +# '.rst': None, |
| 199 | +# '.md': 'myst_parser', |
| 200 | +# } |
0 commit comments