Skip to content
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

remove deprecated configs and associated code/tests #1698

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@
"json_url": json_url,
"version_match": version_match,
},
"navigation_with_keys": False,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False is now the default in theme.conf so we don't need to specify it in our own docs (or in any tests) just to avoid the deprecation warning

# "back_to_top_button": False,
# "search_bar_position": "navbar", # TODO: Deprecated - remove in future version
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT this config was being silently ignored, and associated code was already removed

}

html_sidebars = {
Expand Down
46 changes: 2 additions & 44 deletions docs/user_guide/branding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,48 +142,6 @@ this assumption by supplying both ``text`` and ``alt_text``).
Add favicons
============

.. deprecated:: 0.15

Support for complex and multiple favicons will be dropped in version 0.15. Instead, use the `sphinx-favicon <https://sphinx-favicon.readthedocs.io/en/stable/>`__ extension.
It provides the same functionality using more flexible parameters.


``pydata_sphinx_theme`` supports the `standard sphinx favicon configuration <https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_favicon>`_, using ``html_favicon``.

Additionally, you may add any number of browser- or device-specific favicons of any size.
To do so, use the ``html_theme_options["favicons"]`` configuration key.
The only required argument is ``href``, which can be either an absolute URL (beginning with ``http``) or a local path relative to your ``html_static_path``.
In addition, you may specify a size with ``sizes``, specify a ``rel`` value, and specify a ``color``.
See `this blog post on SVG favicons for more information <https://medium.com/swlh/are-you-using-svg-favicons-yet-a-guide-for-modern-browsers-836a6aace3df>`_.

For example, below we define three extra favicons of different sizes and ``rel`` types, and one with a specific color.

.. code-block:: python

html_theme_options = {
"favicons": [
{
"rel": "icon",
"sizes": "16x16",
"href": "https://secure.example.com/favicon/favicon-16x16.png",
},
{
"rel": "icon",
"sizes": "32x32",
"href": "favicon-32x32.png",
},
{
"rel": "apple-touch-icon",
"sizes": "180x180",
"href": "apple-touch-icon-180x180.png",
"color": "#000000",
},
]
}

``pydata_sphinx_theme`` will add ``link`` tags to your document's ``head``
section, following this pattern:

.. code-block:: html+jinja

<link rel="{{ favicon.rel }}" sizes="{{ favicon.sizes }}" href="{{ favicon.href }}" color="{{ favicon.color }}">
Support for complex and multiple favicons was dropped in version 0.15.3. Instead, use the `sphinx-favicon <https://sphinx-favicon.readthedocs.io/en/stable/>`__ extension.
It provides the same functionality using more flexible parameters.
47 changes: 0 additions & 47 deletions src/pydata_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,6 @@ def update_config(app):
theme_options = utils.get_theme_options_dict(app)
warning = partial(utils.maybe_warn, app)

# TODO: deprecation; remove after 0.14 release
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm this was already removed long ago ? I didn't find it in theme.conf

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if theme_options.get("logo_text"):
logo = theme_options.get("logo", {})
logo["text"] = theme_options.get("logo_text")
theme_options["logo"] = logo
warning(
"The configuration `logo_text` is deprecated. Use `'logo': {'text': }`."
)

# TODO: DEPRECATE after 0.14
if theme_options.get("footer_items"):
theme_options["footer_start"] = theme_options.get("footer_items")
warning(
"`footer_items` is deprecated. Use `footer_start` or `footer_end` instead."
)

# TODO: DEPRECATE after v0.15
if theme_options.get("favicons"):
warning(
"The configuration `favicons` is deprecated. "
"Use the sphinx-favicon extension instead."
)

# TODO: in 0.15, set the default navigation_with_keys value to False and remove this deprecation notice
if theme_options.get("navigation_with_keys", None) is None:
warning(
"The default value for `navigation_with_keys` will change to `False` in "
"the next release. If you wish to preserve the old behavior for your site, "
"set `navigation_with_keys=True` in the `html_theme_options` dict in your "
"`conf.py` file. Be aware that `navigation_with_keys = True` has negative "
"accessibility implications: "
"https://github.com/pydata/pydata-sphinx-theme/issues/1492"
)
theme_options["navigation_with_keys"] = False

# Validate icon links
if not isinstance(theme_options.get("icon_links", []), list):
raise ExtensionError(
Expand Down Expand Up @@ -228,18 +193,6 @@ def update_and_remove_templates(
if asset_path == theme_css_name:
del context["css_files"][i]
break
# Add links for favicons in the topbar
for favicon in context.get("theme_favicons", []):
icon_type = Path(favicon["href"]).suffix.strip(".")
opts = {
"rel": favicon.get("rel", "icon"),
"sizes": favicon.get("sizes", "16x16"),
"type": f"image/{icon_type}",
}
if "color" in favicon:
opts["color"] = favicon["color"]
# Sphinx will auto-resolve href if it's a local file
app.add_css_file(favicon["href"], **opts)

# Add metadata to DOCUMENTATION_OPTIONS so that we can re-use later
# Pagename to current page
Expand Down
7 changes: 1 addition & 6 deletions src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ twitter_url =
icon_links_label = Icon Links
icon_links =
analytics =
favicons =
show_prev_next = True
search_bar_text = Search the docs ...
search_bar_position = sidebar
navigation_with_keys =
navigation_with_keys = False
collapse_navigation = False
navigation_depth = 4
show_nav_level = 1
Expand Down Expand Up @@ -55,6 +53,3 @@ footer_end = theme-version
secondary_sidebar_items = page-toc, edit-this-page, sourcelink
show_version_warning_banner = False
announcement =

# DEPRECATE after 0.14
footer_items =
2 changes: 0 additions & 2 deletions tests/sites/base/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@
html_sourcelink_suffix = ""

# Base options, we can add other key/vals later
html_theme_options = {"navigation_with_keys": False}

html_sidebars = {"section1/index": ["sidebar-nav-bs.html"]}
20 changes: 0 additions & 20 deletions tests/sites/deprecated/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,7 @@

# Base options, we can add other key/vals later
html_theme_options = {
"search_bar_position": "navbar",
"surface_warnings": True,
"logo_text": "DOCS",
"footer_items": ["page-toc.html"],
"favicons": [
{
"rel": "icon",
"sizes": "16x16",
"href": "https://secure.example.com/favicon/favicon-16x16.png",
},
{
"rel": "icon",
"sizes": "32x32",
"href": "favicon-32x32.png",
},
{
"rel": "apple-touch-icon",
"sizes": "180x180",
"href": "apple-touch-icon-180x180.png",
},
],
}

html_sidebars = {"section1/index": ["sidebar-nav-bs.html"]}
2 changes: 0 additions & 2 deletions tests/sites/sidebars/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@
# -- General configuration ---------------------------------------------------

html_theme = "pydata_sphinx_theme"

html_theme_options = {"navigation_with_keys": False}
2 changes: 0 additions & 2 deletions tests/sites/test_included_toc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@
# -- Options for HTML output -------------------------------------------------

html_theme = "pydata_sphinx_theme"

html_theme_options = {"navigation_with_keys": False}
2 changes: 0 additions & 2 deletions tests/sites/test_navbar_no_in_page_headers/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@

html_copy_source = True
html_sourcelink_suffix = ""

html_theme_options = {"navigation_with_keys": False}
Loading
Loading