From 032e74e7004f27a8ce94ea25b65b1216f981744f Mon Sep 17 00:00:00 2001 From: Evan Harvey Date: Tue, 16 Apr 2024 12:44:23 -0600 Subject: [PATCH 1/3] Add initial readthedocs config --- .readthedocs.yaml | 32 ++++++++++++++++++++++++++++++++ doc/conf.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .readthedocs.yaml create mode 100644 doc/conf.py diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 000000000..7560931ef --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,32 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.12" + # You can also specify other tool versions: + # nodejs: "19" + # rust: "1.64" + # golang: "1.19" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: doc/conf.py + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: doc/requirements.txt diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 000000000..bb01469b9 --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,37 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- + +project = 'OpenCSP' +copyright = '2024, OpenCSP Team' +author = 'OpenCSP Team' + +# The full version, including alpha/beta/rc tags +release = 'latest' + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['Thumbs.db', '.DS_Store'] + + +# -- 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' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +html_css_files = ['table_theme.css'] From 034c969e0d059064b0366824a3a2a03b65564873 Mon Sep 17 00:00:00 2001 From: Evan Harvey Date: Tue, 16 Apr 2024 12:58:12 -0600 Subject: [PATCH 2/3] Fix rtd conf --- .readthedocs.yaml | 2 +- doc/conf.py | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 doc/conf.py diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 7560931ef..3bf8cd372 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -17,7 +17,7 @@ build: # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: doc/conf.py + configuration: doc/source/conf.py # Optionally build your docs in additional formats such as PDF and ePub # formats: diff --git a/doc/conf.py b/doc/conf.py deleted file mode 100644 index bb01469b9..000000000 --- a/doc/conf.py +++ /dev/null @@ -1,37 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Project information ----------------------------------------------------- - -project = 'OpenCSP' -copyright = '2024, OpenCSP Team' -author = 'OpenCSP Team' - -# The full version, including alpha/beta/rc tags -release = 'latest' - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['Thumbs.db', '.DS_Store'] - - -# -- 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' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -html_css_files = ['table_theme.css'] From d0cebc265c1b77fb2a8eb2c2e9db18175d032581 Mon Sep 17 00:00:00 2001 From: Evan Harvey Date: Tue, 16 Apr 2024 13:27:22 -0600 Subject: [PATCH 3/3] Fix path on rtd server Fix rtd requirements install --- .readthedocs.yaml | 4 +++- doc/source/conf.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 3bf8cd372..9d3234b26 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.12" + python: "3.10" # You can also specify other tool versions: # nodejs: "19" # rust: "1.64" @@ -29,4 +29,6 @@ sphinx: # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html python: install: + - requirements: requirements.txt - requirements: doc/requirements.txt + diff --git a/doc/source/conf.py b/doc/source/conf.py index 381b97d50..ec357e658 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -11,9 +11,19 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # from pathlib import Path -import sys +import sys, os -sys.path.append(str(Path.cwd().parent.parent.resolve())) +# Check if we're running on Read the Docs' servers +read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True' + +if read_the_docs_build: + cwd = os.getcwd() + print(cwd) + opencsp_path = cwd + "/../" + "../" + os.listdir(Path(opencsp_path)) + sys.path.append(str(opencsp_path)) +else: + sys.path.append(str(Path.cwd().parent.parent.resolve())) # -- Project information -----------------------------------------------------