From 44026e301bc2245aae8f915968dc006599fb64c2 Mon Sep 17 00:00:00 2001 From: Dmitriy Suponitskiy Date: Tue, 16 Dec 2025 17:08:24 -0500 Subject: [PATCH] Changes to automate openfhe-python document generation for readthedocs.org --- docs/conf.py | 30 +++++++++++++++++++++++------- docs/requirements.txt | 1 + 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 7414b06..7b7244a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,10 +12,13 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import os +import sys +this_dir = os.path.dirname(__file__) +repo_root = os.path.abspath(os.path.join(this_dir, "..")) +if repo_root not in sys.path: + sys.path.insert(0, repo_root) # -- Project information ----------------------------------------------------- @@ -45,6 +48,8 @@ 'sphinx.ext.napoleon' ] +autosummary_generate = True + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -75,10 +80,21 @@ # -- Options for HTML output ------------------------------------------------- -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' +# on_rtd is whether we are on readthedocs.org +on_rtd = os.environ.get("READTHEDOCS", None) == "True" + +if not on_rtd: + # Local builds: use sphinx_rtd_theme explicitly + import sphinx_rtd_theme + html_theme = "sphinx_rtd_theme" + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] +else: + # On RTD, the theme is provided automatically, but this is harmless + html_theme = "sphinx_rtd_theme" +# # The theme to use for HTML and HTML Help pages. See the documentation for +# # a list of builtin themes. +# # +# html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/requirements.txt b/docs/requirements.txt index 0b8d435..95d9836 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -10,6 +10,7 @@ imagesize==1.3.0 importlib-metadata>=4.0.0 Jinja2==3.0.3 MarkupSafe>=2.0.0 +openfhe>=1.4.2 packaging==21.3 pybind11>=2.10.3 pybind11-global>=2.10.3