Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement multiversion building for the docs #298

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- name: Build Documentation
run: |
pip install gym || exit 1;
git fetch --all --tags;
make -C docs/ html-examples-short || exit 1;
if: matrix.python-version == 3.8 && matrix.dep == '[all]'
- name: Coveralls
Expand Down
8 changes: 4 additions & 4 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SPHINXBUILD ?= sphinx-multiversion
SOURCEDIR = .
BUILDDIR = _build

Expand All @@ -17,18 +17,18 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)

clean:
rm -rf $(BUILDDIR)/*
rm -rf auto_examples/

html-noplot:
$(SPHINXBUILD) -D plot_gallery=0 -b html $(SOURCEDIR) $(BUILDDIR)/html
$(SPHINXBUILD) -D plot_gallery=0 $(SOURCEDIR) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

html-examples-short:
$(SPHINXBUILD) -D reset_argv=1 -b html $(SOURCEDIR) $(BUILDDIR)/html
$(SPHINXBUILD) -D reset_argv=1 $(SOURCEDIR) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
31 changes: 21 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@
import os
import sys

import msmb_theme
import sphinx_rtd_theme

# -- Project information -----------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import cgp

sys.path.insert(0, os.path.join(os.path.abspath("."), "../"))


# -- Project information -----------------------------------------------------
rootdir = os.path.join(os.getenv("SPHINX_MULTIVERSION_SOURCEDIR", default=os.getcwd()), "../")
sys.path.insert(0, rootdir)
print(sys.path)
import cgp # noqa: E402 isort:skip

print(cgp.__version__)
project = "hal-cgp"
copyright = "2020, Happy Algorithms League"
copyright = "2021, Happy Algorithms League"
author = cgp.__author__

# The full version, including alpha/beta/rc tags
Expand All @@ -40,7 +41,9 @@
"sphinx.ext.autodoc",
"sphinx.ext.linkcode",
"recommonmark",
"sphinx_rtd_theme",
"sphinx_gallery.gen_gallery",
"sphinx_multiversion",
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -57,9 +60,17 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "msmb_theme"
html_theme = "sphinx_rtd_theme"

html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]


html_theme_path = [msmb_theme.get_html_theme_path()]
# Configuration for multiversion builds
smv_branch_whitelist = "master" # Only build master branch
smv_remote_whitelist = r"^.*$"
smv_tag_whitelist = "0.2.0" # Only release 0.2.0 has a sphinx documentation
smv_released_pattern = r".*" # Tags only
smv_outputdir_format = "{ref.name}" # Use the branch/tag name

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
2 changes: 1 addition & 1 deletion extra-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ isort ~=5.2.2
# doc requirements
sphinx ~=3.1.2
recommonmark~=0.6.0
msmb_theme~=1.2.0
sphinx-rtd-theme~=0.5.0
sphinx-gallery~=0.8.0
pillow~=8.1.1
sphinx-multiversion@git+https://git@github.com/Holzhaus/sphinx-multiversion#master