diff --git a/.github/workflows/docs_check.yml b/.github/workflows/docs_check.yml index 349b26a1f..8d75f9712 100644 --- a/.github/workflows/docs_check.yml +++ b/.github/workflows/docs_check.yml @@ -31,5 +31,6 @@ jobs: pip install -r requirements.txt cd doc pip install -r requirements.txt + sudo apt install -y pandoc ./make_docs.sh \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 9d3234b26..d3dd77dcd 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,10 +10,9 @@ build: os: ubuntu-22.04 tools: python: "3.10" - # You can also specify other tool versions: - # nodejs: "19" - # rust: "1.64" - # golang: "1.19" + # Install pandoc for including jupyter notebooks in our generated docs + apt_packages: + - pandoc # Build documentation in the "docs/" directory with Sphinx sphinx: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 81e6ff57b..aec610576 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Online Documentation -------------------- Detailed contribution guidelines may be found in our [online documentation]( -https://opencsp.readthedocs.io/en/main/contributing.html). +https://opencsp.readthedocs.io/en/latest/contributing.html). Legal Disclaimer ---------------- diff --git a/contrib/scripts/sensitive_strings.py b/contrib/scripts/sensitive_strings.py index 75e25e0b6..e28f83631 100644 --- a/contrib/scripts/sensitive_strings.py +++ b/contrib/scripts/sensitive_strings.py @@ -109,7 +109,7 @@ def _is_binary_file(self, file_path: str, file_name_ext: str): ext = ext.lower() if ext == ".ipynb": is_binary_file = True - if self._is_img_ext(ext): + elif self._is_img_ext(ext): if ext in self._text_file_extensions: is_binary_file = False elif (f"{file_path}/{file_name_ext}" in self._text_file_path_name_exts) or ( @@ -118,6 +118,11 @@ def _is_binary_file(self, file_path: str, file_name_ext: str): is_binary_file = False else: is_binary_file = True + elif ft.file_size(ft.join(file_path, file_name_ext)) > 1e6: + # assume any file > 1MB is a binary file, in order to prevent + # sensitive_strings from taking hours to check these files + # needlessly + is_binary_file = True if not is_binary_file: # attempt to parse the file as a text file try: diff --git a/doc/requirements.txt b/doc/requirements.txt index 1344b117f..18b5429c2 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,3 +1,4 @@ sphinx sphinx-argparse -sphinx-rtd-theme \ No newline at end of file +sphinx-rtd-theme +nbsphinx \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index ec357e658..f1ba2d2cb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -45,6 +45,7 @@ "sphinx.ext.todo", "sphinxarg.ext", "sphinx_rtd_theme", + "nbsphinx", ] # Add any paths that contain templates here, relative to this directory. diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index 79bc72528..74d7da2d6 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -24,6 +24,25 @@ NumPy-style docstrings with bulleted lists. We require NumPy compliant docstring Models, Public Classes, and Public Functions. For more internal and development-facing documentation please use hash tags. +All documentation is verified to pass sphinx-build without errors via https://github.com/sandialabs/OpenCSP/blob/develop/.github/workflows/docs_check.yml. +Solely documentation that has a associated sphinx config in https://github.com/sandialabs/OpenCSP/tree/develop/doc/source will be included in this online documentation. +There are several different ways to include documentation in the sphinx config depending on what the source of documentation is. For general guidance, please see +https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html. For examples of how this is currently done in OpenCSP, please see any of the config.rst files in doc/source. A common +use-case is to include NewClass with its documented and undocumented non-private members, to do that you would add the following to +https://github.com/sandialabs/OpenCSP/blob/develop/doc/source/library_reference/app/sofast/config.rst: + + .. code-block:: rst + + opencsp.app.sofast.lib.NewClass + =============================== + + .. currentmodule:: opencsp.app.sofast.lib.NewClass + + .. automodule:: opencsp.app.sofast.lib.NewClass + :members: + :undoc-members: + :show-inheritance: + We highly recommend using Visual Studio Code for development. If using VS Code, please install the following plugins: @@ -72,7 +91,7 @@ commits: for FILE in $(git diff --cached --name-only | egrep '.*\.py$') do if [ -e $FILE ]; then - black $FILE -C -S + black $FILE --line-length 120 -C -S git add $FILE fi done diff --git a/example/csp/base_classes_and_ray_trace.ipynb b/doc/source/example/csp/base_classes_and_ray_trace.ipynb similarity index 99% rename from example/csp/base_classes_and_ray_trace.ipynb rename to doc/source/example/csp/base_classes_and_ray_trace.ipynb index cae3974cb..3b81a5de3 100644 --- a/example/csp/base_classes_and_ray_trace.ipynb +++ b/doc/source/example/csp/base_classes_and_ray_trace.ipynb @@ -8,13 +8,6 @@ "====================================" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "*Last updated May 21, 2024*" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -27,7 +20,7 @@ "- solar fields (to be renamed heliostat fields)\n", "\n", "It will also talk about using ray tracing with these objects.\n", - "
There are TODO notes marked in green like this.
\n", + "