Skip to content

Commit

Permalink
MAINT: Simplify doc/conf.py (mne-tools#11657)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored Apr 27, 2023
1 parent 52506f4 commit cecbf0f
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 220 deletions.
14 changes: 5 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
- run:
name: make test-doc
command: |
if [[ $(cat gitlog.txt) == *"[circle front]"* ]] || [[ $(cat build.txt) == "html_dev-memory" ]] || [[ $(cat build.txt) == "html_stable-memory" ]]; then
if [[ $(cat gitlog.txt) == *"[circle front]"* ]] || [[ $(cat build.txt) == "html-memory" ]] ; then
make test-doc;
mkdir -p doc/_build/test-results/test-doc;
cp junit-results.xml doc/_build/test-results/test-doc/junit.xml;
Expand Down Expand Up @@ -276,7 +276,7 @@ jobs:
- run:
name: Reduce artifact upload time
command: |
if grep -q html_dev-pattern-memory build.txt || grep -q html_dev-noplot build.txt; then
if grep -q html-pattern-memory build.txt || grep -q html-noplot build.txt; then
zip -rm doc/_build/html/_downloads.zip doc/_build/html/_downloads
fi
for NAME in generated auto_tutorials auto_examples; do
Expand All @@ -299,15 +299,11 @@ jobs:
# Save the HTML
- store_artifacts:
path: doc/_build/html/
destination: dev
- store_artifacts:
path: doc/_build/html_stable/
destination: stable
destination: html
- persist_to_workspace:
root: doc/_build
paths:
- html
- html_stable

# Keep these separate, maybe better in terms of size limitations (?)
- save_cache:
Expand Down Expand Up @@ -465,7 +461,7 @@ jobs:
- run:
name: Check docs
command: |
if [ ! -f /tmp/build/html/index.html ] && [ ! -f /tmp/build/html_stable/index.html ]; then
if [ ! -f /tmp/build/html/index.html ] ; then
echo "No files found to upload (build: ${CIRCLE_BRANCH}).";
circleci-agent step halt;
fi;
Expand Down Expand Up @@ -498,7 +494,7 @@ jobs:
else
echo "Deploying stable docs for ${CIRCLE_BRANCH}.";
rm -Rf stable;
cp -a /tmp/build/html_stable stable;
cp -a /tmp/build/html stable;
git add -A;
git commit -m "CircleCI update of stable docs (${CIRCLE_BUILD_NUM}).";
fi;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/circle_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
api-token: ${{ secrets.CIRCLECI_TOKEN }}
artifact-path: 0/dev/index.html
artifact-path: 0/html/index.html
circleci-jobs: build_docs,build_docs_main
job-title: Check the rendered docs here!
34 changes: 0 additions & 34 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,37 +335,3 @@ stages:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'

- job: SphinxWindows
pool:
vmImage: 'windows-latest'
variables:
AZURE_CI_WINDOWS: 'true'
steps:
- bash: |
set -e
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
displayName: Install OpenGL
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
- bash: |
set -eo pipefail
PYTHONUTF8=1 pip install --progress-bar off -r requirements.txt -r requirements_doc.txt
displayName: Install documentation dependencies
- script: pip install -e .
displayName: Install dev MNE
- script: mne sys_info -pd
displayName: Print config and test access to commands
- script: python -c "import numpy; numpy.show_config()"
displayName: Print NumPy config
- bash: |
set -eo pipefail
sed -i 's/.. graphviz::/.. graphviz/g' doc/install/contributing.rst
sed -i 's/.. graphviz::/.. graphviz/g' tutorials/preprocessing/40_artifact_correction_ica.py
sed -i '/sphinx\.ext\.graphviz/d' doc/conf.py
displayName: Skip graph that we cannot render
# TODO: Reenable this once we can get it to work!
# - bash: make -C doc html_dev-noplot
# displayName: 'Build doc'
120 changes: 27 additions & 93 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,125 +4,59 @@
# You can set these variables from the command line.
SPHINXOPTS = -nWT --keep-going
SPHINXBUILD = sphinx-build
PAPER =
MPROF = SG_STAMP_STARTS=true mprof run -E --python sphinx

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d _build/doctrees $(SPHINXOPTS) .

.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
.PHONY: help clean html html-noplot html-pattern linkcheck linkcheck-grep doctest

# make with no arguments will build the first target by default, i.e., build standalone HTML files
first_target: html_dev-noplot
first_target: html-noplot

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html_stable to make standalone HTML files (stable version)"
@echo " html_dev to make standalone HTML files (dev version)"
@echo " html_dev-pattern to make standalone HTML files for one example dir (dev version)"
@echo " *-noplot to make standalone HTML files without plotting"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " html to make standalone HTML files"
@echo " html-memory to make standalone HTML files while monitoring memory usage"
@echo " html-pattern to make standalone HTML files for a specific filename pattern"
@echo " html-front to make standalone HTML files with only the frontpage examples"
@echo " html-noplot to make standalone HTML files without plotting"
@echo " clean to clean HTML files"
@echo " linkcheck to check all external links for integrity"
@echo " linkcheck-grep to grep the linkcheck resut"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " view to view the built HTML"

clean:
-rm -rf _build auto_examples auto_tutorials generated *.stc *.fif *.nii.gz

html_stable:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html_stable
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html_stable."

html_stable-memory:
$(MPROF) -b html $(ALLSPHINXOPTS) _build/html_stable
@echo
@echo "Build finished. The HTML pages are in _build/html_stable."

html_dev:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html"

html_dev-memory:
BUILD_DEV_HTML=1 $(MPROF) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html"
@echo "Build finished. The HTML pages are in _build/html."

html_dev-pattern:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -D sphinx_gallery_conf.filename_pattern=$(PATTERN) -D sphinx_gallery_conf.run_stale_examples=True -b html $(ALLSPHINXOPTS) _build/html
html-memory:
$(MPROF) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html"
@echo "Build finished. The HTML pages are in _build/html."

html_dev-pattern-memory:
BUILD_DEV_HTML=1 $(MPROF) -D sphinx_gallery_conf.filename_pattern=$(PATTERN) -D sphinx_gallery_conf.run_stale_examples=True -b html $(ALLSPHINXOPTS) _build/html
html-pattern:
$(SPHINXBUILD) -D sphinx_gallery_conf.filename_pattern=$(PATTERN) -D sphinx_gallery_conf.run_stale_examples=True -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html"

html_dev-noplot:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html."

html_dev-debug:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -PD plot_gallery=0 -b html $(ALLSPHINXOPTS) _build/html

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

html_dev-front:
@PATTERN="\(30_mne_dspm_loreta.py\|50_decoding.py\|30_strf.py\|20_cluster_1samp_spatiotemporal.py\|20_visualize_evoked.py\)" make html_dev-pattern;

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
@echo
@echo "Build finished. The HTML pages are in _build/dirhtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
$(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished; now you can process the JSON files."
@echo "Build finished. The HTML pages are in _build/html."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in _build/htmlhelp."
html-front:
@PATTERN="\(30_mne_dspm_loreta.py\|50_decoding.py\|30_strf.py\|20_cluster_1samp_spatiotemporal.py\|20_visualize_evoked.py\)" make html-pattern

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in _build/qthelp, like this:"
@echo "# qcollectiongenerator _build/qthelp/MNE.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile _build/qthelp/MNE.qhc"

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
@echo
@echo "Build finished; the LaTeX files are in _build/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
@echo
@echo "The overview file is in _build/changes."
# Aliases for old methods
html_dev-pattern-memory: html-pattern
html_dev-noplot: html-noplot
html_dev-front: html-front

linkcheck:
@$(SPHINXBUILD) -b linkcheck -D nitpicky=0 -D plot_gallery=0 -D exclude_patterns="cited.rst,whats_new.rst,configure_git.rst" -d _build/doctrees . _build/linkcheck
Expand Down
Loading

0 comments on commit cecbf0f

Please sign in to comment.