Unverified Commit 84fccf57 authored by Rhett Ying's avatar Rhett Ying Committed by GitHub
Browse files

[Doc] add include/exclude_patterns when build sphinx (#5195)

parent 56682040
...@@ -26,6 +26,7 @@ author = 'DGL Team' ...@@ -26,6 +26,7 @@ author = 'DGL Team'
import dgl import dgl
version = dgl.__version__ version = dgl.__version__
release = dgl.__version__ release = dgl.__version__
dglbackend = os.environ.get("DGLBACKEND", "pytorch")
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
...@@ -74,6 +75,13 @@ language = None ...@@ -74,6 +75,13 @@ language = None
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path. # This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [] exclude_patterns = []
if dglbackend == "mxnet":
include_patterns = ['api/python/nn-mxnet']
elif dglbackend == "tensorflow":
include_patterns = ['api/python/nn-tensorflow']
else:
# pytorch
exclude_patterns = ['api/python/nn-tensorflow', 'api/python/nn-mxnet']
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = None pygments_style = None
...@@ -230,14 +238,10 @@ sphinx_gallery_conf = { ...@@ -230,14 +238,10 @@ sphinx_gallery_conf = {
} }
# Compatibility for different backend when builds tutorials # Compatibility for different backend when builds tutorials
dglbackend = os.environ.get("DGLBACKEND", "")
if dglbackend == 'mxnet': if dglbackend == 'mxnet':
sphinx_gallery_conf['filename_pattern'] = "/*(?<=mx)\.py" sphinx_gallery_conf['filename_pattern'] = "/*(?<=mx)\.py"
if dglbackend == 'pytorch': if dglbackend == 'pytorch':
sphinx_gallery_conf['filename_pattern'] = "/*(?<!mx)\.py" sphinx_gallery_conf['filename_pattern'] = "/*(?<!mx)\.py"
else:
sphinx_gallery_conf['ignore_pattern'] = ".*tutorials/.*"
sphinx_gallery_conf['plot_gallery'] = False
# sphinx-copybutton tool # sphinx-copybutton tool
copybutton_prompt_text = r'>>> |\.\.\. ' copybutton_prompt_text = r'>>> |\.\.\. '
......
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