"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "4088e8a85158f2dbcad2e23214ee4ad3dca11865"
Unverified Commit 7cd6257f authored by Minjie Wang's avatar Minjie Wang Committed by GitHub
Browse files

[Doc] Update script for building doc (#5525)

parent 8c71628e
DGL document and tutorial folder
================================
Requirements
------------
You need to build DGL locally first (as described [here](https://docs.dgl.ai/install/index.html#install-from-source)), and ensure the following python packages are installed:
* sphinx==4.2.0
* sphinx-gallery
* sphinx_rtd_theme
* sphinx_copybutton
* nbsphinx>=0.8.11
* nbsphinx-link>=1.3.0
* pillow
* matplotlib
* nltk
* seaborn
* ogb
* rdflib
To build the doc:
- Create the developer conda environment using the script [here](../script/create_dev_conda_env.sh).
- Activate the developer conda environment.
- Build DGL from source using the script [here](../script/build_dgl.sh).
- Build the doc using the script [here](../script/build_doc.sh).
Build documents
---------------
First, clean up existing files:
```
./clean.sh
```
To build for PyTorch backend only,
```
make pytorch
```
To build for MXNet backend only,
```
make mxnet
```
To build for both backends,
```
make html
```
Render locally
--------------
To render locally:
```
cd build/html
python3 -m http.server 8000
```
Add new folders
---------------
Add the path of the new folder in the two lists `examples_dirs` and `gallery_dirs` in docs/source/conf.py.
#!/bin/bash
set -e
usage() {
cat << EOF
usage: bash $0 OPTIONS
examples:
Build doc with PyTorch-backend: bash $0 -p
Build doc with MXNet-backend: bash $0 -m
Build doc with TensorFlow-backend: bash $0 -t
Build incrementally with PyTorch-backend: bash $0
Remove all outputs and restart a PyTorch build: bash $0 -p -r
Build DGL documentation. By default, build incrementally on top of the current state.
OPTIONS:
-h Show this message.
-p Build doc with PyTorch backend.
-m Build doc with MXNet backend.
-t Build doc with TensorFlow backend.
-r Remove all outputs.
EOF
}
backend="pytorch"
# Parse flags.
while getopts "hpmtr" flag; do
if [[ ${flag} == "p" ]]; then
backend="pytorch"
elif [[ ${flag} == "m" ]]; then
backend="mxnet"
elif [[ ${flag} == "t" ]]; then
backend="tensorflow"
elif [[ ${flag} == "r" ]]; then
remove="YES"
elif [[ ${flag} == "h" ]]; then
usage
exit 0
else
usage
exit 1
fi
done
if [[ -z ${DGL_HOME} ]]; then
echo "ERROR: Please make sure environment variable DGL_HOME is set correctly."
exit 1
fi
if [[ ! ${PWD} == ${DGL_HOME} ]]; then
echo "ERROR: This script only works properly from DGL root directory."
echo " Current: ${PWD}"
echo "DGL_HOME: ${DGL_HOME}"
exit 1
fi
cd ${DGL_HOME}/docs
if [[ ${remove} == "YES" ]]; then
bash clean.sh
fi
export DGLBACKEND=$backend
export DGL_LIBRARY_PATH=${DGL_HOME}/build
export PYTHONPATH=${DGL_HOME}/python:$PYTHONPATH
make $backend
exit 0
......@@ -2,6 +2,9 @@ name: __NAME__
dependencies:
- python=__PYTHON_VERSION__
- pip
- graphviz
- pandoc
- pygraphviz
- pip:
- --find-links https://download.pytorch.org/whl/torch_stable.html
- cython
......@@ -26,5 +29,15 @@ dependencies:
- torchmetrics
- tqdm
- boto3 # AWS SDK for python
- sphinx==4.2.0
- sphinx-gallery
- sphinx_rtd_theme
- sphinx_copybutton
- sphinxemoji
- nbsphinx>=0.8.11
- nbsphinx-link>=1.3.0
- pillow
- seaborn
- jupyter_http_over_ws
variables:
DGL_HOME: __DGL_HOME__
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment