Pyvcloud uses Sphinx to generate documentation from Python docstrings and publishes it to GitHub Pages via the gh-pages branch. The build process involves generating HTML in the local docs directory and then syncing those files to a separate documentation clone repository.
1. Prepare the documentation clone (One-time setup)
Clone the repository into a separate directory to act as your documentation host and set the PYVCLOUD_DOCS environment variable.
git clone git@github.com:vmware/pyvcloud.git pyvcloud-docs
export PYVCLOUD_DOCS=$PWD/pyvcloud-docs
2. Generate and sync documentation
Run these commands from the docs directory of your main repository:
pip3 install -r doc-requirements.txt # Ensure Sphinx is installed
sphinx-apidoc -f --separate -o source ../pyvcloud
make html
rsync -avr build/html/ $PYVCLOUD_DOCS
Note: -f overwrites previous files and --separate generates separate pages.
3. Push to GitHub
Commit the changes in the documentation clone and push to the gh-pages branch:
cd $PYVCLOUD_DOCS
git add .
git commit -m "Documentation build"
git push origin gh-pages
pip3 install -r doc-requirements.txt
sphinx-apidoc -f --separate -o source ../pyvcloud
make html
rsync -avr build/html/ $PYVCLOUD_DOCS