From 9a10f9d578739f20ea9c30a6c62cff1ead5c28f6 Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Thu, 16 Feb 2023 02:33:27 -0600 Subject: [PATCH] maint: remove sphinx-panels support; remove deprecated config shims (#1188) --- docs/user_guide/web-components.rst | 18 +---- src/pydata_sphinx_theme/__init__.py | 37 +-------- .../styles/extensions/_sphinx_panels.scss | 81 ------------------- .../assets/styles/pydata-sphinx-theme.scss | 1 - .../theme/pydata_sphinx_theme/theme.conf | 7 -- tests/sites/deprecated/conf.py | 2 +- tests/test_build.py | 14 +++- 7 files changed, 17 insertions(+), 143 deletions(-) delete mode 100644 src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_panels.scss diff --git a/docs/user_guide/web-components.rst b/docs/user_guide/web-components.rst index 90144d3a3..d01f8dca9 100644 --- a/docs/user_guide/web-components.rst +++ b/docs/user_guide/web-components.rst @@ -4,28 +4,12 @@ Sphinx Design Components ======================== -Cards and tabs provide some extra UI flexibility for your content. Both `sphinx-design `__ and `sphinx-panels `__ can be used with this theme. This theme provides custom CSS to ensure that their look and feel is consistent with this theme. +Cards and tabs provide some extra UI flexibility for your content. This theme provides custom CSS to ensure that `sphinx-design `__ elements look and feel consistent with this theme. .. seealso:: For more about how to use these extensions, see `the sphinx-design documentation `_. -.. danger:: - - ``sphinx-panels`` is no longer maintained and we recommend you switch to ``sphinx-design``. - We will deprecate support for sphinx-panels soon. - - To use the :code:`sphinx-panels` extention, add these lines to your custom CSS to overwrite the shadows of the panels: - - .. code-block:: css - - /* overwrite panels shadows using pydata-sphinx-theme variable */ - .shadow { - box-shadow: 0 0.5rem 1rem var(--pst-color-shadow) !important; - } - - This modification is not needed when using the :code:`sphinx-design` extention. - Below you can find some examples of the components created with the :code:`sphinx-design` extension. .. _badges-buttons: diff --git a/src/pydata_sphinx_theme/__init__.py b/src/pydata_sphinx_theme/__init__.py index 073120a56..8f675333a 100644 --- a/src/pydata_sphinx_theme/__init__.py +++ b/src/pydata_sphinx_theme/__init__.py @@ -35,21 +35,7 @@ def update_config(app): theme_options = app.config.html_theme_options - # DEPRECATE >= v0.10 - if theme_options.get("search_bar_position") == "navbar": - logger.warning( - "Deprecated config `search_bar_position` used." - "Use `search-field.html` in `navbar_end` template list instead." - ) - - # DEPRECATE >= 0.11 - if theme_options.get("left_sidebar_end"): - theme_options["primary_sidebar_end"] = theme_options.get("left_sidebar_end") - logger.warning( - "The configuration `left_sidebar_end` is deprecated." - "Use `primary_sidebar_end`" - ) - + # TODO: deprecation; remove after 0.14 release if theme_options.get("logo_text"): logo = theme_options.get("logo", {}) logo["text"] = theme_options.get("logo_text") @@ -58,6 +44,7 @@ def update_config(app): "The configuration `logo_text` is deprecated." "Use `'logo': {'text': }`." ) + # TODO: deprecation; remove after 0.13 release if theme_options.get("page_sidebar_items"): theme_options["secondary_sidebar_items"] = theme_options.get( "page_sidebar_items" @@ -86,6 +73,7 @@ def update_config(app): app.config.values["html_permalinks_icon"] = ("#", *icon_default[1:]) # Raise a warning for a deprecated theme switcher config + # TODO: deprecation; remove after 0.13 release if "url_template" in theme_options.get("switcher", {}): logger.warning( "html_theme_options['switcher']['url_template'] is no longer supported." @@ -188,14 +176,6 @@ def prepare_html_config(app, pagename, templatename, context, doctree): if not isinstance(theme_logo, dict): raise ValueError(f"Incorrect logo config type: {type(theme_logo)}") - # DEPRECATE: >= 0.11 - if context.get("theme_logo_link"): - logger.warning( - "DEPRECATION: Config `logo_link` will be deprecated in v0.11. " - "Use the `logo.link` configuration dictionary instead." - ) - theme_logo = context.get("theme_logo_link") - context["theme_logo"] = theme_logo # update version number @@ -415,14 +395,6 @@ def generate_header_nav_html(n_links_before_dropdown=5): return out - # TODO: Deprecate after v0.12 - def generate_nav_html(*args, **kwargs): - logger.warning( - "`generate_nav_html` is deprecated and will be removed." - "Use `generate_toctree_html` instead." - ) - generate_toctree_html(*args, **kwargs) - # Cache this function because it is expensive to run, and becaues Sphinx # somehow runs this twice in some circumstances in unpredictable ways. @lru_cache(maxsize=None) @@ -588,9 +560,6 @@ def navbar_align_class(): context["generate_toc_html"] = generate_toc_html context["navbar_align_class"] = navbar_align_class - # TODO: Deprecate after v0.12 - context["generate_nav_html"] = generate_nav_html - def _add_collapse_checkboxes(soup): """Add checkboxes to collapse children in a toctree.""" diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_panels.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_panels.scss deleted file mode 100644 index bef0497d4..000000000 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_panels.scss +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Special-cases for the sphinx-panels lib - * Mainly to make it compatible with the dark/light themes of pydata-sphinx-theme - * DEPRECATE after 0.10 - */ - -/******************************************************************************* -* color -*/ -@use "../variables/color" as *; - -@each $mode in (light, dark) { - html[data-theme="#{$mode}"] { - $value: map-get(map-get($pst-semantic-colors, "on-background"), $mode); - --pst-color-panel-background: $value; - } -} - -/******************************************************************************* - * sphinx-panels includes Bootstrap 4, which uses .container which can conflict - * with docutils' `.. container::` directive. - */ -.container[role="main"] { - max-width: initial; - padding-left: initial; - padding-right: initial; -} - -/******************************************************************************* - * cards - */ - -.sphinx-bs .card { - border: 1px solid var(--pst-color-border); - background-color: var(--pst-color-panel-background); - - .card-header { - border-bottom: 1px solid var(--pst-color-border); - } - - .card-footer { - border-top: 1px solid var(--pst-color-border); - } -} - -/******************************************************************************* - * tabs - */ - -.bd-content .tabbed-set { - > input { - // Active tab label - &:checked + label { - border-color: var(--pst-color-primary); - color: var(--pst-color-primary); - } - - // hover label - &:not(:checked) + label:hover { - border-color: var(--pst-color-primary); - color: var(--pst-color-primary); - opacity: 0.5; - } - } - - // Tab label - > label { - color: var(--pst-color-text-muted); - - // Hovered label - html &:hover { - color: var(--pst-color-primary); - border-color: var(--pst-color-primary); - opacity: 0.5; - } - } - - > .tabbed-content { - border-color: var(--pst-color-border); - } -} diff --git a/src/pydata_sphinx_theme/assets/styles/pydata-sphinx-theme.scss b/src/pydata_sphinx_theme/assets/styles/pydata-sphinx-theme.scss index 1b196e390..bc3c838c6 100644 --- a/src/pydata_sphinx_theme/assets/styles/pydata-sphinx-theme.scss +++ b/src/pydata_sphinx_theme/assets/styles/pydata-sphinx-theme.scss @@ -69,7 +69,6 @@ @import "./extensions/execution"; @import "./extensions/pydata"; @import "./extensions/sphinx_design"; -@import "./extensions/sphinx_panels"; @import "./extensions/togglebutton"; @import "./extensions/notebooks"; @import "./extensions/leaflet"; diff --git a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf index 01c1b4402..7105d124e 100644 --- a/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf +++ b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf @@ -49,12 +49,5 @@ footer_end = theme-version.html secondary_sidebar_items = page-toc.html, edit-this-page.html, sourcelink.html announcement = -# DEPRECATE after 0.11 -logo_text = - -# DEPRECATE after 0.12 -left_sidebar_end = -page_sidebar_items = - # DEPRECATE after 0.14 footer_items = diff --git a/tests/sites/deprecated/conf.py b/tests/sites/deprecated/conf.py index f9b2f7da3..5c41a34db 100644 --- a/tests/sites/deprecated/conf.py +++ b/tests/sites/deprecated/conf.py @@ -20,13 +20,13 @@ # Base options, we can add other key/vals later html_theme_options = { "search_bar_position": "navbar", - "left_sidebar_end": ["sidebar-ethical-ads.html"], "logo_text": "DOCS", "page_sidebar_items": [ "page-toc.html", "edit-this-page.html", "sourcelink.html", ], + "footer_items": ["test.html"], } html_sidebars = {"section1/index": ["sidebar-nav-bs.html"]} diff --git a/tests/test_build.py b/tests/test_build.py index cdd21884c..3961a7507 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -865,8 +865,18 @@ def test_deprecated_build_html(sphinx_build_factory, file_regression): assert (sphinx_build.outdir / "index.html").exists(), sphinx_build.outdir.glob("*") # check the deprecation warnings - warnings = sphinx_build.warnings.split("WARNING: ") - assert len(warnings) == 5 # testing the text of the warning is not necessary here + warnings = sphinx_build.warnings.strip("\n").split("\n") + warnings = [w.lstrip("\x1b[91m").rstrip("\x1b[39;49;00m\n") for w in warnings] + expected_warnings = ( + "The configuration `logo_text` is deprecated", + "The configuration `page_sidebar_items` is deprecated", + "`footer_items` is deprecated", + "unsupported theme option 'logo_text'", + "unsupported theme option 'page_sidebar_items'", + ) + assert len(warnings) == len(expected_warnings) + for exp_warn in expected_warnings: + assert exp_warn in sphinx_build.warnings index_html = sphinx_build.html_tree("index.html") subpage_html = sphinx_build.html_tree("section1/index.html")