Skip to content

Commit

Permalink
Use kedro-sphinx-theme (#3675)
Browse files Browse the repository at this point in the history
* Remove the loading of unused CSS files

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Use kedro-sphinx-theme

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Empty

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Add note about possible deprecation

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

---------

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Co-authored-by: tynandebold <thdebold@gmail.com>
Co-authored-by: Merel Theisen <49397448+merelcht@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 19, 2024
1 parent 39080a9 commit 34cf5c2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 118 deletions.
73 changes: 0 additions & 73 deletions docs/source/_templates/layout.html

This file was deleted.

34 changes: 1 addition & 33 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from __future__ import annotations

import importlib
import os
import re
import sys
from inspect import getmembers, isclass, isfunction
Expand Down Expand Up @@ -202,7 +201,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = "kedro-sphinx-theme"
here = Path(__file__).parent.absolute()

# Theme options are theme-specific and customise the look and feel of a theme
Expand Down Expand Up @@ -492,39 +491,8 @@ def autodoc_process_docstring(app, what, name, obj, options, lines): # noqa: PL
remove_arrows_in_examples(lines)


def env_override(default_appid):
build_version = os.getenv("READTHEDOCS_VERSION")

if build_version == "latest":
return os.environ["HEAP_APPID_QA"]
if build_version == "stable":
return os.environ["HEAP_APPID_PROD"]

return default_appid # default to Development for local builds


def _add_jinja_filters(app):
# https://github.com/crate/crate/issues/10833
from sphinx.builders.latex import LaTeXBuilder
from sphinx.builders.linkcheck import CheckExternalLinksBuilder

# LaTeXBuilder is used in the PDF docs build,
# and it doesn't have attribute 'templates'
if not (isinstance(app.builder, (LaTeXBuilder, CheckExternalLinksBuilder))):
app.builder.templates.environment.filters["env_override"] = env_override


def _override_permalinks_icon(app):
# https://github.com/readthedocs/sphinx_rtd_theme/issues/98#issuecomment-1503211439
app.config.html_permalinks_icon = "¶"


def setup(app):
app.connect("builder-inited", _add_jinja_filters)
app.connect("builder-inited", _override_permalinks_icon)
app.connect("autodoc-process-docstring", autodoc_process_docstring)
# fix a bug with table wraps in Read the Docs Sphinx theme:
# https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html


# (regex, restructuredText link replacement, object) list
Expand Down
1 change: 1 addition & 0 deletions kedro/framework/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def python_call(


def find_stylesheets() -> Iterable[str]: # pragma: no cover
# TODO: Deprecate this function in favour of kedro-sphinx-theme
"""Fetch all stylesheets used in the official Kedro documentation"""
css_path = Path(__file__).resolve().parents[1] / "html" / "_static" / "css"
return (str(css_path / "copybutton.css"),)
Expand Down
13 changes: 1 addition & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,9 @@ test = [
"types-toml"
]
docs = [
"docutils<0.21",
"sphinx>=5.3,<7.3",
"sphinx_rtd_theme==2.0.0",
# Regression on sphinx-autodoc-typehints 1.21
# that creates some problematic docstrings
"sphinx-autodoc-typehints==1.20.2",
"sphinx_copybutton==0.5.2",
"sphinx-notfound-page",
"kedro-sphinx-theme @ git+https://github.com/kedro-org/kedro-sphinx-theme@main",
"ipykernel>=5.3, <7.0",
"myst-parser>=1.0,<2.1",
"Jinja2<3.2.0",
"sphinx-last-updated-by-git",
"sphinx-favicon",
"sphinxcontrib-youtube",
]
jupyter = [
"ipylab>=1.0.0",
Expand Down

0 comments on commit 34cf5c2

Please sign in to comment.