Docs Contributions#
Vapor’s documentation website is managed in its own GitHub Repo and uses the Sphinx documentation generator. The documentation is generated from the .rst files within the docs directory. (Generating documentation for the Python Class Reference has some extra steps, and is explained later.)
To make changes to the documentation, follow these steps:
Fork the documentation GitHub repository and clone the fork to your local machine
Within this clone, make changes to the appropriate .rst files
View your changes by generating the documentation locally, following the instructions below
Push the updated .rst and newly generated html files to your forked repository
Open a pull request to merge your fork with the main repository
To reproduce this documentation locally, we recommend setting up a conda environment with the environment.yml file included in this repo. Once installed, the .rst files located in the docs/ directory can be edited to produce new html.
To build your conda environment, run the following commands in your terminal.
cd VaporDocumentationWebsite
conda config --add channels conda-forge
conda env create -f environment.yml
conda activate VaporDocumentationWebsite
pip install sphinxcontrib-googleanalytics
Once this conda environment has been configured, the html can be generated with the following steps.
cd VaporDocumentationWebsite/docs
make html
cp -r html/* ../
The third line moves the html files from VaporDocumentationWebsite/docs/html to the root directory, VaporDocumentationWebsite. Without this step, github pages will not host the html files.
VAPOR’s Class Reference (Doxygen)#
To make changes to VAPOR’s Class Reference you will need to first compile the Doxygen html documentation from VAPOR’s main repository and apply copy it to the directory VaporDocumentationWebsite/vaporApplicationReference/vaporClassReference.
conda install doxygen
Now acquire and configure VAPOR’s main repository as described here. Once you’ve issued the cmake command, the console should indicate that Doxygen was found along with the path it presides at. Now compile the documentation from your build directory with the following command, and copy it to the aforementioned documentation directory.
make doc
cp -r doc/html/* ~/VaporDocumentationWebsite/docs/vaporApplicationReference/vaporClassReference
Contributing to Python Class Reference#
If you want to make changes to the python class reference, there are a couple of additional steps. Sphinx builds the class reference from the version of Vapor Python installed in your current conda environment using comments within the code. To make changes to the function descriptions, you’ll need to edit the comments for the function in the code, which will either be in a Python file or a C++ header file. Here is a step by step guide:
Fork both VAPOR’s main repository and Vapor’s documentation repository. You’ll need to submit changes to both of these repositories. Clone each of these forks to your local machine.
Within the VAPOR clone, make changes to the comments in the appropriate .py and .h files.
Editing the GetRenderer function in /VAPOR/apps/pythonapi/vapor/session.py using Python syntax:
... def GetRenderer(): """ Add new comment between triple quotes directly after function definition """ ...
Editing the SetAxisAnnotationEnabled function in /VAPOR/include/vapor/AxisAnnotations.h using C++ and Doxygen syntax:
... //! Add new comment directly before function definition bool SetAxisAnnotationEnabled(bool val); ...
Create the VaporDocumentationWebsite conda environment:
cd VaporDocumentationWebsite
conda config --add channels conda-forge
conda env create -f environment.yml
conda activate VaporDocumentationWebsite
pip install sphinxcontrib-googleanalytics
pip install sphinx-copybutton
Build Vapor Python from the source code in your VAPOR clone following these instructions.
Generate the html on your local machine
cd VaporDocumentationWebsite/docs
make html
cp -r html/* ../
Preview the html to make sure everything displays as intended
Push all changes you made in the VAPOR repository (.py and .h files) and in the VaporDocumentationWebsite repository (.rst and .html files).
Open a pull request in both repositories to merge the changes.