Skip to content

DOC Update web site to pydata-sphinx theme. #26809

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

Closed
wants to merge 11 commits into from
1 change: 1 addition & 0 deletions build_tools/circle/doc_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- memory_profiler
- compilers
- sphinx=6.0.0
- pydata-sphinx-theme
- sphinx-gallery
- sphinx-copybutton
- numpydoc
Expand Down
127 changes: 62 additions & 65 deletions build_tools/circle/doc_linux-64_conda.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build_tools/circle/doc_min_dependencies_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- memory_profiler
- compilers
- sphinx=6.0.0 # min
- pydata-sphinx-theme=0.13.3 # min
- sphinx-gallery=0.10.1 # min
- sphinx-copybutton=0.5.2 # min
- numpydoc=1.2.0 # min
Expand Down
46 changes: 22 additions & 24 deletions build_tools/circle/doc_min_dependencies_linux-64_conda.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions build_tools/update_environments_and_lock_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def remove_from(alist, to_remove):
"memory_profiler",
"compilers",
"sphinx",
"pydata-sphinx-theme",
"sphinx-gallery",
"sphinx-copybutton",
"numpydoc",
Expand All @@ -268,6 +269,7 @@ def remove_from(alist, to_remove):
"cython": "min",
"scikit-image": "min",
"sphinx": "min",
"pydata-sphinx-theme": "min",
"pandas": "min",
"sphinx-gallery": "min",
"sphinx-copybutton": "min",
Expand All @@ -288,6 +290,7 @@ def remove_from(alist, to_remove):
"memory_profiler",
"compilers",
"sphinx",
"pydata-sphinx-theme",
"sphinx-gallery",
"sphinx-copybutton",
"numpydoc",
Expand Down
2 changes: 0 additions & 2 deletions doc/common_pitfalls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

:parenttoc: True

.. include:: includes/big_toc_css.rst

.. _common_pitfalls:

=========================================
Expand Down
2 changes: 0 additions & 2 deletions doc/computing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
Computing with scikit-learn
============================

.. include:: includes/big_toc_css.rst

.. toctree::
:maxdepth: 2

Expand Down
48 changes: 20 additions & 28 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,29 @@

# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = "scikit-learn-modern"
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.
html_theme_options = {
"legacy_google_analytics": True,
"analytics": True,
"mathjax_path": mathjax_path,
"link_to_live_contributing_page": not parsed_version.is_devrelease,
"logo": {
"link": "http://scikit-learn.org/stable/index.html",
"alt_text": "scikit-learn home page",
},
"icon_links": [
{
# Label for this link
"name": "GitHub",
# URL where the link will redirect
"url": "https://github.com/scikit-learn/scikit-learn", # required
# Icon class (if "type": "fontawesome"), or path to local
# image (if "type": "local")
"icon": "fa-brands fa-square-github",
# The type of image to be used
"type": "fontawesome",
},
],
}

# Add any paths that contain custom themes here, relative to this directory.
Expand All @@ -221,7 +234,7 @@
# 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_static_path = ["images"]
html_static_path = ["images", "css"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down Expand Up @@ -567,27 +580,6 @@ def make_carousel_thumbs(app, exception):
sphinx_gallery.gen_rst.scale_image(image, c_thumb, max_width, 190)


def filter_search_index(app, exception):
if exception is not None:
return

# searchindex only exist when generating html
if app.builder.name != "html":
return

print("Removing methods from search index")

searchindex_path = os.path.join(app.builder.outdir, "searchindex.js")
with open(searchindex_path, "r") as f:
searchindex_text = f.read()

searchindex_text = re.sub(r"{__init__.+?}", "{}", searchindex_text)
searchindex_text = re.sub(r"{__call__.+?}", "{}", searchindex_text)

with open(searchindex_path, "w") as f:
f.write(searchindex_text)


def generate_min_dependency_table(app):
"""Generate min dependency table for docs."""
from sklearn._min_dependencies import dependent_packages
Expand Down Expand Up @@ -675,7 +667,7 @@ def setup(app):

# to hide/show the prompt in code examples:
app.connect("build-finished", make_carousel_thumbs)
app.connect("build-finished", filter_search_index)
# app.connect("build-finished", filter_search_index)


# The following is used by sphinx.ext.linkcode to provide links to github
Expand Down
22 changes: 14 additions & 8 deletions doc/contents.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.. include:: includes/big_toc_css.rst
.. include:: tune_toc.rst

.. Places global toc into the sidebar

:globalsidebartoc: True
Expand All @@ -14,11 +11,20 @@ Table Of Contents
.. toctree::
:maxdepth: 2

preface
tutorial/index
getting_started
install
user_guide
glossary
auto_examples/index
modules/classes
auto_examples/index
Community <https://blog.scikit-learn.org/>
getting_started
tutorial/index
whats_new
glossary
developers/index
faq
support
related_projects
roadmap
governance
about
Other Versions and Download <https://scikit-learn.org/dev/versions.html>
Loading