#2369: Reduce dependency on manually replacing primaite version across documentation
This commit is contained in:
19
docs/conf.py
19
docs/conf.py
@@ -10,6 +10,7 @@ import datetime
|
|||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import furo # noqa
|
import furo # noqa
|
||||||
|
|
||||||
@@ -63,3 +64,21 @@ html_theme = "furo"
|
|||||||
html_static_path = ["_static"]
|
html_static_path = ["_static"]
|
||||||
html_theme_options = {"globaltoc_collapse": True, "globaltoc_maxdepth": 2}
|
html_theme_options = {"globaltoc_collapse": True, "globaltoc_maxdepth": 2}
|
||||||
html_copy_source = False
|
html_copy_source = False
|
||||||
|
|
||||||
|
|
||||||
|
def replace_token(app: Any, docname: Any, source: Any):
|
||||||
|
"""Replaces a token from the list of tokens."""
|
||||||
|
result = source[0]
|
||||||
|
for key in app.config.tokens:
|
||||||
|
result = result.replace(key, app.config.tokens[key])
|
||||||
|
source[0] = result
|
||||||
|
|
||||||
|
|
||||||
|
tokens = {"{VERSION}": release} # Token VERSION is replaced by the value of the PrimAITE version in the version file
|
||||||
|
"""Dict containing the tokens that need to be replaced in documentation."""
|
||||||
|
|
||||||
|
|
||||||
|
def setup(app: Any):
|
||||||
|
"""Custom setup for sphinx."""
|
||||||
|
app.add_config_value("tokens", {}, True)
|
||||||
|
app.connect("source-read", replace_token)
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ Running Jupyter Notebooks
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
:caption: Unix
|
:caption: Unix
|
||||||
|
|
||||||
cd ~/primaite/PRIMAITE_VERSION_TOKEN
|
cd ~/primaite/{VERSION}
|
||||||
|
|
||||||
.. code-block:: powershell
|
.. code-block:: powershell
|
||||||
:caption: Windows (Powershell)
|
:caption: Windows (Powershell)
|
||||||
|
|
||||||
cd ~\primaite\PRIMAITE_VERSION_TOKEN
|
cd ~\primaite\{VERSION}
|
||||||
|
|
||||||
2. Run jupyter notebook
|
2. Run jupyter notebook
|
||||||
|
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ Install PrimAITE
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
:caption: Unix
|
:caption: Unix
|
||||||
|
|
||||||
mkdir -p ~/primaite/3.0.0b6
|
mkdir -p ~/primaite/{VERSION}
|
||||||
|
|
||||||
.. code-block:: powershell
|
.. code-block:: powershell
|
||||||
:caption: Windows (Powershell)
|
:caption: Windows (Powershell)
|
||||||
|
|
||||||
mkdir ~\primaite\3.0.0b6
|
mkdir ~\primaite\{VERSION}
|
||||||
|
|
||||||
|
|
||||||
2. Navigate to the primaite directory and create a new python virtual environment (venv)
|
2. Navigate to the primaite directory and create a new python virtual environment (venv)
|
||||||
@@ -51,7 +51,7 @@ Install PrimAITE
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
:caption: Unix
|
:caption: Unix
|
||||||
|
|
||||||
cd ~/primaite/3.0.0b6
|
cd ~/primaite/{VERSION}
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
|
|
||||||
.. code-block:: powershell
|
.. code-block:: powershell
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Outputs
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
Running a session creates a session output directory in your user data folder. The filepath looks like this:
|
Running a session creates a session output directory in your user data folder. The filepath looks like this:
|
||||||
``~/primaite/3.0.0b6/sessions/YYYY-MM-DD/HH-MM-SS/``. This folder contains the simulation sys logs generated by each node,
|
``~/primaite/{VERSION}/sessions/YYYY-MM-DD/HH-MM-SS/``. This folder contains the simulation sys logs generated by each node,
|
||||||
the saved agent checkpoints, and final model. The folder also contains a .json file for each episode step that
|
the saved agent checkpoints, and final model. The folder also contains a .json file for each episode step that
|
||||||
contains the action, reward, and simulation state. These can be found in
|
contains the action, reward, and simulation state. These can be found in
|
||||||
``~/primaite/3.0.0b6/sessions/YYYY-MM-DD/HH-MM-SS/simulation_output/episode_<n>/step_metadata/step_<n>.json``
|
``~/primaite/{VERSION}/sessions/YYYY-MM-DD/HH-MM-SS/simulation_output/episode_<n>/step_metadata/step_<n>.json``
|
||||||
|
|||||||
Reference in New Issue
Block a user