From 2774623fba2f0c065fb8beb3397d23f68de9dd98 Mon Sep 17 00:00:00 2001 From: Czar Echavez Date: Tue, 14 May 2024 07:36:29 +0100 Subject: [PATCH] #2472: switch to using nbsphinx + added readme steps to setup pandoc + revert changes --- .gitignore | 2 +- README.md | 17 +- docs/Makefile | 6 - docs/conf.py | 49 ++-- docs/index.rst | 2 +- docs/make.bat | 45 +--- .../{ => notebooks}/executed_notebooks.rst | 7 +- pyproject.toml | 3 +- ...a-Manipulation-Customising-Red-Agent.ipynb | 25 +- .../Data-Manipulation-E2E-Demonstration.ipynb | 223 ++++++++++-------- .../Training-an-RLLIB-MARL-System.ipynb | 7 - .../notebooks/Training-an-RLLib-Agent.ipynb | 7 - .../notebooks/Using-Episode-Schedules.ipynb | 10 +- src/primaite/notebooks/multi-processing.ipynb | 2 +- .../network_simulator_demo.ipynb | 6 +- 15 files changed, 208 insertions(+), 203 deletions(-) rename docs/source/{ => notebooks}/executed_notebooks.rst (82%) diff --git a/.gitignore b/.gitignore index 0d27eb1c..448db6ae 100644 --- a/.gitignore +++ b/.gitignore @@ -83,7 +83,7 @@ target/ # Jupyter Notebook .ipynb_checkpoints PPO_UC2/ -docs/_static/notebooks/html/*.html +docs/source/notebooks/*.ipynb # IPython profile_default/ diff --git a/README.md b/README.md index 2265538a..3fd73b53 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,22 @@ python -m jupyter notebook ``` Then, click the URL provided by the jupyter command to open the jupyter application in your browser. You can also open notebooks in your IDE if supported. -## 📚 Building documentation +## 📚 Documentation + +### Pre requisites + +Building the documentation requires the installation of Pandoc + +##### Unix +```bash +sudo apt-get install pandoc +``` + +##### Other operating systems +Follow the steps in https://pandoc.org/installing.html + +### Building the documentation + The PrimAITE documentation can be built with the following commands: ##### Unix diff --git a/docs/Makefile b/docs/Makefile index bd4ef1db..2346738f 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,8 +6,6 @@ SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = _build -JUPYTEROUTPUTPATH="_static\notebooks\html" - # Remove command is different depending on OS ifdef OS RM = IF exist $(AUTOSUMMARY) ( RMDIR $(AUTOSUMMARY) /s /q ) @@ -31,8 +29,4 @@ clean: %: Makefile | clean pip-licenses --format=rst --with-urls --output-file=source/primaite-dependencies.rst - jupyter nbconvert --execute --to html --output-dir _static/notebooks/html ../src/primaite/**/*.ipynb - - cp -r ../src/primaite/notebooks/_package_data _static/notebooks/html/_package_data _static/notebooks/html/_package_data - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py index 33e192aa..008c23a1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,7 +9,9 @@ import datetime # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information import os +import shutil import sys +from pathlib import Path from typing import Any import furo # noqa @@ -43,11 +45,12 @@ html_title = f"{project} v{release} docs" # ones. extensions = [ "sphinx.ext.autodoc", # Core Sphinx library for auto html doc generation from docstrings - "sphinx.ext.autosummary", # Create summary tables for modules/classes/methods etc + # "sphinx.ext.autosummary", # Create summary tables for modules/classes/methods etc "sphinx.ext.intersphinx", # Link to other project's documentation (see mapping below) "sphinx.ext.viewcode", # Add a link to the Python source code for classes, functions etc. "sphinx.ext.todo", "sphinx_copybutton", # Adds a copy button to code blocks + "nbsphinx", ] templates_path = ["_templates"] @@ -64,33 +67,7 @@ html_theme = "furo" html_static_path = ["_static"] html_theme_options = {"globaltoc_collapse": True, "globaltoc_maxdepth": 2} html_copy_source = False - - -def get_notebook_links() -> str: - """ - Returns a string which will be added to the RST. - - Allows for dynamic addition of notebooks to the documentation. - """ - notebooks = os.listdir("_static/notebooks/html") - - links = [] - links.append("