|
| 1 | +# Configuration file for the Sphinx documentation builder. |
| 2 | +# |
| 3 | +# This file only contains a selection of the most common options. For a full |
| 4 | +# list see the documentation: |
| 5 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html |
| 6 | + |
| 7 | +# -- Path setup -------------------------------------------------------------- |
| 8 | + |
| 9 | +# If extensions (or modules to document with autodoc) are in another directory, |
| 10 | +# add these directories to sys.path here. If the directory is relative to the |
| 11 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 12 | +# |
| 13 | +import os |
| 14 | +from importlib import metadata |
| 15 | + |
| 16 | +# -- Project information ----------------------------------------------------- |
| 17 | + |
| 18 | +project = "vuecore" |
| 19 | +copyright = "2024, Multiomics-Analytics-Group" |
| 20 | +author = ( |
| 21 | + "Multiomics-Analytics-Group, Sebastián Ayala Ruano, Henry Webel, Alberto Santos" |
| 22 | +) |
| 23 | +PACKAGE_VERSION = metadata.version("vuecore") |
| 24 | +version = PACKAGE_VERSION |
| 25 | +release = PACKAGE_VERSION |
| 26 | + |
| 27 | + |
| 28 | +# -- General configuration --------------------------------------------------- |
| 29 | + |
| 30 | +# Add any Sphinx extension module names here, as strings. They can be |
| 31 | +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 32 | +# ones. |
| 33 | +extensions = [ |
| 34 | + "sphinx.ext.autodoc", |
| 35 | + "sphinx.ext.autodoc.typehints", |
| 36 | + "sphinx.ext.viewcode", |
| 37 | + "sphinx.ext.napoleon", |
| 38 | + "sphinx.ext.intersphinx", |
| 39 | + "sphinx_new_tab_link", |
| 40 | + "myst_nb", |
| 41 | +] |
| 42 | + |
| 43 | +# https://myst-nb.readthedocs.io/en/latest/computation/execute.html |
| 44 | +nb_execution_mode = "auto" |
| 45 | + |
| 46 | +myst_enable_extensions = ["dollarmath", "amsmath"] |
| 47 | + |
| 48 | +# Plolty support through require javascript library |
| 49 | +# https://myst-nb.readthedocs.io/en/latest/render/interactive.html#plotly |
| 50 | +html_js_files = [ |
| 51 | + "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js" |
| 52 | +] |
| 53 | + |
| 54 | +# https://myst-nb.readthedocs.io/en/latest/configuration.html |
| 55 | +# Execution |
| 56 | +nb_execution_raise_on_error = True |
| 57 | +# Rendering |
| 58 | +nb_merge_streams = True |
| 59 | +# maximum execution time per cell in seconds |
| 60 | +nb_execution_timeout = 120 |
| 61 | + |
| 62 | +# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats |
| 63 | +# ! if you use it, then you cannot directly execute the notebook in the browser in colab |
| 64 | +# (the file needs to be fetched from the repository) |
| 65 | +# just keep both syncing it using papermill |
| 66 | +# nb_custom_formats = {".py": ["jupytext.reads", {"fmt": "py:percent"}]} |
| 67 | + |
| 68 | +# Add any paths that contain templates here, relative to this directory. |
| 69 | +templates_path = ["_templates"] |
| 70 | + |
| 71 | +# List of patterns, relative to source directory, that match files and |
| 72 | +# directories to ignore when looking for source files. |
| 73 | +# This pattern also affects html_static_path and html_extra_path. |
| 74 | +exclude_patterns = [ |
| 75 | + "_build", |
| 76 | + "Thumbs.db", |
| 77 | + ".DS_Store", |
| 78 | + "jupyter_execute", |
| 79 | + "conf.py", |
| 80 | +] |
| 81 | + |
| 82 | + |
| 83 | +# Intersphinx options |
| 84 | +intersphinx_mapping = { |
| 85 | + "python": ("https://docs.python.org/3", None), |
| 86 | + "networkx": ("https://networkx.org/documentation/stable/", None), |
| 87 | + "pyvis": ("https://pyvis.readthedocs.io/en/stable/", None), |
| 88 | + "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), |
| 89 | + # "scikit-learn": ("https://scikit-learn.org/stable/", None), |
| 90 | + "matplotlib": ("https://matplotlib.org/stable/", None), |
| 91 | + "numpy": ("https://numpy.org/doc/stable/", None), |
| 92 | +} |
| 93 | + |
| 94 | +# -- Options for HTML output ------------------------------------------------- |
| 95 | + |
| 96 | +# The theme to use for HTML and HTML Help pages. See the documentation for |
| 97 | +# a list of builtin themes. |
| 98 | +# See: |
| 99 | +# https://github.com/executablebooks/MyST-NB/blob/master/docs/conf.py |
| 100 | +# html_title = "" |
| 101 | +html_theme = "sphinx_book_theme" |
| 102 | +# html_logo = "_static/logo-wide.svg" |
| 103 | +# html_favicon = "_static/logo-square.svg" |
| 104 | +html_theme_options = { |
| 105 | + "github_url": "https://github.com/Multiomics-Analytics-Group/vuecore", |
| 106 | + "repository_url": "https://github.com/Multiomics-Analytics-Group/vuecore", |
| 107 | + "repository_branch": "main", |
| 108 | + "home_page_in_toc": True, |
| 109 | + "path_to_docs": "docs", |
| 110 | + "show_navbar_depth": 1, |
| 111 | + "use_edit_page_button": True, |
| 112 | + "use_repository_button": True, |
| 113 | + "use_download_button": True, |
| 114 | + "launch_buttons": { |
| 115 | + "colab_url": "https://colab.research.google.com" |
| 116 | + # "binderhub_url": "https://mybinder.org", |
| 117 | + # "notebook_interface": "jupyterlab", |
| 118 | + }, |
| 119 | + "navigation_with_keys": False, |
| 120 | +} |
| 121 | + |
| 122 | +# Add any paths that contain custom static files (such as style sheets) here, |
| 123 | +# relative to this directory. They are copied after the builtin static files, |
| 124 | +# so a file named "default.css" will overwrite the builtin "default.css". |
| 125 | +# html_static_path = ["_static"] |
| 126 | + |
| 127 | + |
| 128 | +# -- Setup for sphinx-apidoc ------------------------------------------------- |
| 129 | + |
| 130 | +# Read the Docs doesn't support running arbitrary commands like tox. |
| 131 | +# sphinx-apidoc needs to be called manually if Sphinx is running there. |
| 132 | +# https://github.com/readthedocs/readthedocs.org/issues/1139 |
| 133 | + |
| 134 | +if os.environ.get("READTHEDOCS") == "True": |
| 135 | + from pathlib import Path |
| 136 | + |
| 137 | + PROJECT_ROOT = Path(__file__).parent.parent |
| 138 | + PACKAGE_ROOT = PROJECT_ROOT / "src" / "vuecore" |
| 139 | + |
| 140 | + def run_apidoc(_): |
| 141 | + from sphinx.ext import apidoc |
| 142 | + |
| 143 | + apidoc.main( |
| 144 | + [ |
| 145 | + "--force", |
| 146 | + "--implicit-namespaces", |
| 147 | + "--module-first", |
| 148 | + "--separate", |
| 149 | + "-o", |
| 150 | + str(PROJECT_ROOT / "docs" / "reference"), |
| 151 | + str(PACKAGE_ROOT), |
| 152 | + str(PACKAGE_ROOT / "*.c"), |
| 153 | + str(PACKAGE_ROOT / "*.so"), |
| 154 | + ] |
| 155 | + ) |
| 156 | + |
| 157 | + def setup(app): |
| 158 | + app.connect("builder-inited", run_apidoc) |
0 commit comments