diff --git a/doc/conf.py b/doc/conf.py index d459cdfd3f1af..74e37d01307be 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -17,6 +17,7 @@ import warnings import re from packaging.version import parse +from pathlib import Path # If extensions (or modules to document with autodoc) are in another # directory, add these directories to sys.path here. If the directory @@ -208,6 +209,23 @@ # If true, the reST sources are included in the HTML build as _sources/name. html_copy_source = True +# Adds variables into templates +html_context = {} +# finds latest release highlights and places it into HTML context for +# index.html +release_highlights_dir = Path("..") / "examples" / "release_highlights" +# Finds the highlight with the latest version number +latest_highlights = sorted(release_highlights_dir.glob( + "plot_release_highlights_*.py"))[-1] +latest_highlights = latest_highlights.with_suffix('').name +html_context["release_highlights"] = \ + f"auto_examples/release_highlights/{latest_highlights}" + +# get version from higlight name assuming highlights have the form +# plot_release_highlights_0_22_0 +highlight_version = ".".join(latest_highlights.split("_")[-3:-1]) +html_context["release_highlights_version"] = highlight_version + # -- Options for LaTeX output ------------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). diff --git a/doc/templates/index.html b/doc/templates/index.html index 8d3bdfaec2b28..367e6a3c01902 100644 --- a/doc/templates/index.html +++ b/doc/templates/index.html @@ -8,7 +8,7 @@

scikit-learn

Machine Learning in Python

Getting Started - What's New in {{ release }} + Release Highlights for {{ release_highlights_version }} GitHub
@@ -160,7 +160,7 @@

News

  • March 2020. scikit-learn 0.22.2 is available for download (Changelog).
  • January 2020. scikit-learn 0.22.1 is available for download (Changelog). -
  • December 2019. scikit-learn 0.22 is available for download (Changelog). +
  • December 2019. scikit-learn 0.22 is available for download (Changelog and Release Highlights).
  • Scikit-learn from 0.21 requires Python 3.5 or greater.
  • diff --git a/doc/themes/scikit-learn-modern/nav.html b/doc/themes/scikit-learn-modern/nav.html index 57c631f6cbee7..4fbd22f48a4dd 100644 --- a/doc/themes/scikit-learn-modern/nav.html +++ b/doc/themes/scikit-learn-modern/nav.html @@ -9,6 +9,7 @@ {%- set drop_down_navigation = [ ('Getting Started', pathto('getting_started')), ('Tutorial', pathto('tutorial/index')), + ("What's new", 'whats_new/v' + version + '.html'), ('Glossary', pathto('glossary')), ('Development', pathto('developers/index')), ('FAQ', pathto('faq')),