Files
Gymnasium/docs/README.md

52 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2022-09-13 20:27:34 +01:00
# Gymnasium-docs
This folder contains the documentation for [Gymnasium](https://github.com/Farama-Foundation/Gymnasium).
2022-09-13 20:27:34 +01:00
## Instructions for modifying environment pages
### Editing an environment page
Fork Gymnasium and edit the docstring in the environment's Python file. Then, pip install your Gymnasium fork and run `docs/_scripts/gen_mds.py` in this repo. This will automatically generate a Markdown documentation file for the environment.
2022-09-13 20:27:34 +01:00
### Adding a new environment
2023-06-12 11:20:44 +01:00
Ensure the environment is in Gymnasium (or your fork). Ensure that the environment's Python file has a properly formatted markdown docstring. Install using `pip install -e .` and then run `docs/_scripts/gen_mds.py`. This will automatically generate a md page for the environment. Then complete the [other steps](#other-steps).
2022-09-13 20:27:34 +01:00
#### Other steps
2023-06-12 11:20:44 +01:00
- Add the corresponding gif into the `docs/_static/videos/{ENV_TYPE}` folder, where `ENV_TYPE` is the category of your new environment (e.g. mujoco). Follow snake_case naming convention. Alternatively, run `docs/_scripts/gen_gifs.py`.
2022-09-13 20:27:34 +01:00
- Edit `docs/environments/{ENV_TYPE}/index.md`, and add the name of the file corresponding to your new environment to the `toctree`.
## Build the Documentation
Install the required packages and Gymnasium (or your fork):
```
pip install gymnasium
pip install -r docs/requirements.txt
2022-09-13 20:27:34 +01:00
```
To build the documentation once:
```
cd docs
make dirhtml
2022-09-13 20:27:34 +01:00
```
To rebuild the documentation automatically every time a change is made:
```
cd docs
sphinx-autobuild -b dirhtml --watch ../gymnasium --re-ignore "pickle$" . _build
2022-09-13 20:27:34 +01:00
```
2022-10-21 16:36:36 +01:00
You can then open http://localhost:8000 in your browser to watch a live updated version of the documentation.
2022-10-21 16:36:36 +01:00
## Writing Tutorials
We use Sphinx-Gallery to build the tutorials inside the `docs/tutorials` directory. Check `docs/tutorials/demo.py` to see an example of a tutorial and [Sphinx-Gallery documentation](https://sphinx-gallery.github.io/stable/syntax.html) for more information.
To convert Jupyter Notebooks to the python tutorials you can use [this script](https://gist.github.com/mgoulao/f07f5f79f6cd9a721db8a34bba0a19a7).
2022-10-21 16:36:36 +01:00
If you want Sphinx-Gallery to execute the tutorial (which adds outputs and plots) then the file name should start with `run_`. Note that this adds to the build time so make sure the script doesn't take more than a few seconds to execute.