Repository: autoreject/autoreject (language: python)

Issue:
REL: 0.4.2
following with some more cleanups after #302

for a 0.4.2 patch release


Discussion / hints:
I also added a new repository secret: 
![image](https://github.com/autoreject/autoreject/assets/9084751/16f528ea-ceb8-4578-be1c-831421fac8e5)


This will make the circleci-artifact-redirector work again. Following instructions from https://github.com/larsoner/circleci-artifacts-redirector-action
also adjusted branch protection rules for "required CI checks" to use the Py versions that we are using now.

interestingly, the dropdown menu for versions does not work anymore, neither on this PR, nor on master.

Try here:

- master: https://autoreject.github.io/dev/index.html
- this PR: https://output.circle-artifacts.com/output/job/d505096a-7f44-4bb8-b3e0-ee6cf173596f/artifacts/0/html/index.html

any idea why @larsoner ?
> any idea why @larsoner ?

I think I know the answer, and it's "no, but let's just switch to the pydata sphinx theme" :see_no_evil:  :angel: 

Fix patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d97ac66..68d19b3 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -7,7 +7,7 @@ jobs:
             - checkout
             - restore_cache:
                 keys:
-                  - data-cache-v0-{{ checksum "./autoreject/__init__.py" }}-{{ checksum "setup.py" }}
+                  - data-cache-v1-{{ checksum "./autoreject/__init__.py" }}-{{ checksum "setup.py" }}
             - run:
                 name: Setup python3 environment
                 command: |
@@ -47,11 +47,12 @@ jobs:
                 path: ./doc/_build/html/
                 destination: html
             - save_cache:
-                key: data-cache-v0-{{ checksum "./autoreject/__init__.py" }}-{{ checksum "setup.py" }}
+                key: data-cache-v1-{{ checksum "./autoreject/__init__.py" }}-{{ checksum "setup.py" }}
                 paths:
                   - ~/.mne
                   - ~/mne_data/MNE-sample-data
                   - ~/project/examples/ds000117
+                  - ~/project/examples/ds002778
 
     docs-deploy:
         # will only be run on master branch
@@ -79,7 +80,6 @@ jobs:
               # push built docs directory on the `gh-pages` branch
               name: Deploy docs to gh-pages branch
               command: |
-                touch doc/_build/html/.nojekyll
                 node_modules/gh-pages/bin/gh-pages.js \
                     --dotfiles \
                     --message "doc updates [skip ci]" \
diff --git a/.gitignore b/.gitignore
index 969ebca..007df65 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+examples/ds000117
+examples/ds002778
+
 .vscode/
 htmlcov
 coverage.xml
diff --git a/doc/Makefile b/doc/Makefile
index 97c357f..93bca25 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -23,25 +23,6 @@ help:
 view:
 	@python -c "import webbrowser; webbrowser.open_new_tab('file://$(PWD)/_build/html/index.html')"
 
-install:
-	rm -rf _build/doctrees _build/autoreject.github.io
-	# first clone the autoreject/autoreject.github.io repo because it may ask
-	# for password and we don't want to delay this long build in
-	# the middle of it
-	# --no-checkout just fetches the root folder without content
-	# --depth 1 is a speed optimization since we don't need the
-	# history prior to the last commit
-	git clone --no-checkout --depth 1 git@github.com:autoreject/autoreject.github.io.git _build/autoreject.github.io
-	touch _build/autoreject.github.io/.nojekyll
-	make html
-	cd _build/ && \
-	cp -r html/* autoreject.github.io && \
-	cd autoreject.github.io && \
-	git add * && \
-	git add .nojekyll && \
-	git commit -a -m 'Make install' && \
-	git push
-
 html-noplot:
 	$(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
 	@echo
diff --git a/doc/_static/style.css b/doc/_static/style.css
new file mode 100644
index 0000000..204207f
--- /dev/null
+++ b/doc/_static/style.css
@@ -0,0 +1,20 @@
+a[class^="sphx-glr-backref-module-autoreject"] {
+    /* make all autoreject backrefs bold */
+    font-weight: 800;
+  }
+
+  span.option {
+    /* avoid breaking lines in our command-line parameters */
+    white-space: nowrap;
+  }
+
+  /* ************************************************* Previous / Next buttons */
+  .prev-next-bottom a.left-prev:before {
+    content:"❮\00A0"
+  }
+  .prev-next-bottom a.right-next:after {
+    content:"\00A0❯"
+  }
+  .prev-next-bottom a.right-next {
+    text-align: right;
+  }
diff --git a/doc/_static/versions.json b/doc/_static/versions.json
new file mode 100644
index 0000000..dd7f375
--- /dev/null
+++ b/doc/_static/versions.json
@@ -0,0 +1,22 @@
+[
+    {
+        "name": "0.5 (devel)",
+        "version": "dev",
+        "url": "https://autoreject.github.io/dev/"
+    },
+    {
+        "name": "0.4 (stable)",
+        "version": "stable",
+        "url": "https://autoreject.github.io/stable/"
+    },
+    {
+        "name": "0.3",
+        "version": "0.3",
+        "url": "https://autoreject.github.io/v0.3/"
+    },
+    {
+        "name": "0.2",
+        "version": "0.2",
+        "url": "https://autoreject.github.io/v0.2/"
+    }
+]
diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html
index d9fb727..b74e2a1 100644
--- a/doc/_templates/layout.html
+++ b/doc/_templates/layout.html
@@ -1,22 +1,19 @@
-{# Import the theme's layout. #}
-{% extends "!layout.html" %}
+{%- extends "pydata_sphinx_theme/layout.html" %}
 
-{# remove site and page menus #}
-{%- block sidebartoc %}
+{% block fonts %}
+    <!-- add `style` or `link` tags with your CSS `@font-face` declarations here -->
+    <!-- ... and a `style` tag with setting `font-family` in `body` and `.header-style` -->
+    <!-- ... and optionally preload the `woff2` for snappier page loads -->
+    <!-- or add a `style` tag with a font fallback chain with good cross-platform coverage -->
+    <style>
+        body,.header-style {font-family: 'Source Sans Pro', sans-serif;}
+        code,kbd,pre,samp {font-family: 'Source Code Pro', monospace;}
+    </style>
 {% endblock %}
-{%- block sidebarrel %}
-{% endblock %}
-
-{%- block content %}
-{{ navBar() }}
-<div class="container content-container">
-  {% block body %}{% endblock %}
-</div>
 
-<!-- Github "fork me" ribbon -->
-<a href="https://github.com/autoreject/autoreject"><img style="position: absolute; top: 50px; right: 0; border: 0;" 
-src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67"
-alt="Fork me on GitHub"
-data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
-
-{%- endblock %}
+{% block extrahead %}
+    <link rel="canonical" href="https://autoreject.github.io/stable/index.html" />
+    <script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>
+    <script type="text/javascript" src="{{ pathto('_static/scrollfix.js', 1) }}"></script>
+{{ super() }}
+{% endblock %}
diff --git a/doc/_templates/navbar.html b/doc/_templates/navbar.html
deleted file mode 100644
index c8fc5b0..0000000
--- a/doc/_templates/navbar.html
+++ /dev/null
@@ -1,19 +0,0 @@
-{% extends "!navbar.html" %}
-
-{% block navbarsearch %}
-<div class="navbar-form navbar-right navbar-btn dropdown btn-group-sm" style="margin-left: 20px; margin-top: 5px; margin-bottom: 5px">
-  <button type="button" class="btn btn-{% if (build_dev_html|tobool) %}danger{% else %}primary{% endif %} navbar-btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
-    v{{ release }}
-    <span class="caret"></span>
-  </button>
-  <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
-    <li><a href="https://autoreject.github.io/dev/index.html">Development</a></li>
-    <li><a href="https://autoreject.github.io/stable/index.html">Stable</a></li>
-    <li><a href="https://autoreject.github.io/v0.4/index.html">v0.4</a></li>
-    <li><a href="https://autoreject.github.io/v0.3/index.html">v0.3</a></li>
-    <li><a href="https://autoreject.github.io/v0.2/index.html">v0.2</a></li>
-  </ul>
-</div>
-
-{{ super() }}
-{% endblock %}
diff --git a/doc/api.rst b/doc/api.rst
index b472fd7..8121939 100644
--- a/doc/api.rst
+++ b/doc/api.rst
@@ -1,6 +1,6 @@
 :orphan:
 
-.. _api_documentation:
+.. _api:
 
 =================
 API Documentation
diff --git a/doc/conf.py b/doc/conf.py
index 96f3648..6c4e587 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -3,8 +3,6 @@
 import sys
 from datetime import date
 
-import sphinx_bootstrap_theme
-
 import autoreject
 
 
@@ -14,10 +12,17 @@
 curdir = os.path.dirname(__file__)
 sys.path.append(os.path.abspath(os.path.join(curdir, '..', 'autoreject')))
 
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#
+needs_sphinx = '2.0'
+
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
 extensions = [
+    'sphinx.ext.githubpages',
     'sphinx.ext.autodoc',
     'sphinx.ext.autosummary',
     'sphinx.ext.doctest',
@@ -37,8 +42,6 @@
 copybutton_prompt_text = r">>> |\.\.\. |\$ "
 copybutton_prompt_is_regexp = True
 
-autosummary_generate = True  # generate autosummary even if no references
-
 # configure numpydoc
 numpydoc_xref_param_type = True
 numpydoc_show_class_members = False  # noqa:E501  https://stackoverflow.com/a/34604043/5201771
@@ -49,6 +52,8 @@
     "n_interpolate", "consensus", "n_epochs", "n_channels", "n_data_channels",
 }
 
+# generate autosummary even if no references
+autosummary_generate = True
 autodoc_default_options = {
     "members": True,
     "inherited-members": True,
@@ -57,6 +62,8 @@
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
+html_static_path = ['_static']
+html_css_files = ['style.css']
 
 # The suffix(es) of source filenames.
 # You can specify multiple suffix as a list of string:
@@ -82,35 +89,45 @@
 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
 
 # -- Options for HTML output ----------------------------------------------
-
-# see: https://sphinx-bootstrap-theme.readthedocs.io/en/latest/README.html
-# Clean up sidebar: Do not show "Source" link
 html_show_sourcelink = False
+html_copy_source = False
 
-html_theme = 'bootstrap'
-html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
-
+html_theme = 'pydata_sphinx_theme'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
+switcher_version_match = "dev" if "dev" in release else version
+
 html_theme_options = {
-    'navbar_title': 'autoreject',
-    'bootswatch_theme': "united",
-    'navbar_sidebarrel': False,  # no "previous / next" navigation
-    'navbar_pagenav': False,  # no "Page" navigation in sidebar
-    'bootstrap_version': '3',
-    'navbar_links': [
-        ("Examples", "auto_examples/index"),
-        ("Explanation", "explanation"),
-        ("FAQ", "faq"),
-        ("API", "api"),
-        ("What's new", "whats_new"),
-        ("GitHub", "https://github.com/autoreject/autoreject", True)
+    'icon_links': [
+        dict(name='GitHub',
+             url='https://github.com/autoreject/autoreject',
+             icon='fab fa-github-square'),
     ],
+    'icon_links_label': 'Quick Links',  # for screen reader
+    'use_edit_page_button': False,
+    'navigation_with_keys': False,
+    'show_toc_level': 1,
+    "navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"],
+    "switcher": {
+        # "json_url": "https://mne.tools/dev/_static/versions.json",
+        "json_url": "https://raw.githubusercontent.com/autoreject/autoreject/pydata/sphinx/doc/_static/versions.json",  # noqa: E501
+        "version_match": switcher_version_match,
+    },
+}
 
+html_context = {
+    "default_mode": "auto",
+    # next 3 are for the "edit this page" button
+    "github_user": "autoreject",
+    "github_repo": "autoreject",
+    "github_version": "master",
+    "doc_path": "doc",
 }
 
+html_sidebars = {}
+
 # Example configuration for intersphinx: refer to the Python standard library.
 intersphinx_mapping = {
     'python': ('https://docs.python.org/3', None),
diff --git a/doc/explanation.rst b/doc/explanation.rst
index 729a851..17ebe30 100644
--- a/doc/explanation.rst
+++ b/doc/explanation.rst
@@ -1,5 +1,7 @@
 :orphan:
 
+.. _explanation:
+
 Explanation
 ===========
 
diff --git a/doc/faq.rst b/doc/faq.rst
index 239e5bd..f5cb9fe 100644
--- a/doc/faq.rst
+++ b/doc/faq.rst
@@ -1,5 +1,7 @@
 :orphan:
 
+.. _faq:
+
 Frequently asked questions
 ==========================
 
diff --git a/doc/index.rst b/doc/index.rst
index 60aa1c0..412e99a 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -1,6 +1,20 @@
+.. title:: autoreject
+
+.. The page title must be in rST for it to show in next/prev page buttons.
+   Therefore we add a special style rule to only this page that hides h1 tags
+
 autoreject
 ==========
 
+.. toctree::
+   :hidden:
+
+   Examples<auto_examples/index.rst>
+   Explanation<explanation>
+   FAQ<faq>
+   API<api>
+   What's new<whats_new>
+
 This is a library to automatically reject bad trials and repair bad sensors in magneto-/electroencephalography (M/EEG) data.
 
 .. include:: ../README.rst
diff --git a/examples/README.txt b/examples/README.txt
index 964aab6..26c41cc 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -1,4 +1,4 @@
-.. _general_examples:
+.. _examples:
 
 Examples Gallery
 ================
diff --git a/setup.py b/setup.py
index ce559c5..c990110 100644
--- a/setup.py
+++ b/setup.py
@@ -71,7 +71,7 @@
               'doc': [
                   'sphinx',
                   'sphinx-gallery',
-                  'sphinx_bootstrap_theme',
+                  'pydata-sphinx-theme',
                   'sphinx-copybutton',
                   'sphinx-github-role',
                   'numpydoc',


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 1d77e83..c21e9d4 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -19,7 +19,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.10']
+        python-version: ['3.11']
     name: "Flake8 and check-manifest ${{ matrix.python-version }}"
     steps:
     - uses: actions/checkout@v3