Skip to content

Commit

Permalink
fix: change Sphinx theme to PyData's
Browse files Browse the repository at this point in the history
  • Loading branch information
asoplata committed Jan 21, 2025
1 parent e56f53e commit b85b222
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 128 deletions.
Binary file added doc/_static/hnn-medium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions doc/_static/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"name": "Development",
"version": "dev",
"url": "https://jonescompneurolab.github.io/hnn-core/dev/index.html"
},
{
"name": "Stable",
"version": "stable",
"url": "https://jonescompneurolab.github.io/hnn-core/stable/index.html"
},
{
"name": "v0.4",
"version": "0.4",
"url": "https://jonescompneurolab.github.io/hnn-core/v0.4/index.html"
},
{
"name": "v0.3",
"version": "0.3",
"url": "https://jonescompneurolab.github.io/hnn-core/v0.3/index.html"
},
{
"name": "v0.2",
"version": "0.2",
"url": "https://jonescompneurolab.github.io/hnn-core/v0.2/index.html"
},
{
"name": "v0.1",
"version": "0.1",
"url": "https://jonescompneurolab.github.io/hnn-core/v0.1/index.html"
}
]
20 changes: 0 additions & 20 deletions doc/_templates/navbar.html

This file was deleted.

70 changes: 0 additions & 70 deletions doc/_templates/search.html

This file was deleted.

84 changes: 50 additions & 34 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
#
import os
import sys
# sys.path.insert(0, os.path.abspath('.'))
import sphinx_gallery
from sphinx_gallery.sorting import ExampleTitleSortKey, ExplicitOrder

import sphinx_bootstrap_theme

# 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.
Expand Down Expand Up @@ -95,48 +91,68 @@
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'gui/index.rst']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "pydata_sphinx_theme"

# versions
#
# TODO GH #969 Once we're ready to merge this into `master`, we need to switch
# this to dev's version
#
html_theme = 'bootstrap'
# The actual, local version of `versions.json` that you should edit (if
# necessary) is in `_static/versions.json`.
json_versions_url = "https://jonescompneurolab.github.io/hnn-core/stable/_static/versions.json"
switcher_version_match = "dev" if ".rc" in version else version

# 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.
#
# documentation:
# https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html
html_theme_options = {
'navbar_sidebarrel': False,
'navbar_links': [
("Examples", "auto_examples/index"),
("API", "api"),
("Glossary", "glossary"),
("What's new", "whats_new"),
("GitHub", "https://github.com/jonescompneurolab/hnn-core", True)
"external_links": [
{
"url": "https://github.com/jonescompneurolab/hnn-core",
"name": "GitHub (Code)",
},
{
"url": "https://pypi.org/project/hnn-core/",
"name": "PyPI",
},
{
"url": "https://hnn.brown.edu/",
"name": "HNN Frontpage",
},
],
'bootswatch_theme': "yeti"
"header_links_before_dropdown": 7,
"navbar_align": "left",
"navbar_start": ["navbar-logo"],
"navbar_center": ["navbar-nav"],
"navbar_end": ["version-switcher"],
"pygments_dark_style": "monokai",
"switcher": {
"json_url": json_versions_url,
"version_match": switcher_version_match,
},
}

# 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,
# so a file named "default.css" will overwrite the builtin "default.css".
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}

# so a file named "default.css" will overwrite the builtin "default.css". This
# folder also holds versions.json.
html_static_path = ["_static"]
html_logo = "_static/hnn-medium.png"

# The default sidebars (for documents that don't match any pattern) are defined
# by theme itself. Builtin themes are using these templates by default:
# ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``. Not that the following removes the "primary" sidebar (on
# the left), but not the "secondary" # sidebar (on the right), for the PyData
# theme. From
# https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/layout.html#remove-the-primary-sidebar-from-pages
html_sidebars = {
"**": []
}

# -- Options for HTMLHelp output ---------------------------------------------

Expand Down
13 changes: 13 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@

..
The below is needed to populate the "navbar" at the top.
.. toctree::
:hidden:

Examples <auto_examples/index>
API <api>
glossary
whats_new
Contributing <contributing>

.. include:: ../README.rst
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ def run(self):
'opt': ['scikit-learn'],
'parallel': ['joblib', 'psutil'],
'test': ['flake8', 'pytest', 'pytest-cov', 'pytest-xdist'],
'docs': ['mne', 'nibabel', 'pooch', 'tdqm',
'sphinx', 'sphinx-gallery',
'sphinx_bootstrap_theme', 'sphinx-copybutton',
'pillow', 'numpydoc',
'docs': ['mne', 'nibabel', 'numpydoc', 'pillow', 'pooch',
'pydata-sphinx-theme', 'sphinx', 'sphinx-gallery',
'sphinx-copybutton', 'tdqm',
],
'gui': ['ipywidgets>=8.0.0', 'ipykernel', 'ipympl', 'voila', ],
}
Expand Down

0 comments on commit b85b222

Please sign in to comment.