| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,7 +56,7 @@ jobs: | |||
| 56 | 56 | matrix: | |
| 57 | 57 | os: ["ubuntu-latest", "windows-latest"] | |
| 58 | 58 | # Test minimum supported and latest stable from 3.x series | |
| 59 | - python-version: ["3.9", "3"] | ||
| 59 | + python-version: ["3.10", "3"] | ||
| 60 | 60 | steps: | |
| 61 | 61 | - uses: actions/checkout@v4 | |
| 62 | 62 | - uses: actions/setup-python@v5 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | # Python Docs Sphinx Theme | |
| 2 | 2 | ||
| 3 | 3 | This is the theme for the Python documentation. | |
| 4 | - It requires Python 3.9 or newer and Sphinx 3.4 or newer. | ||
| 4 | + It requires Python 3.10 or newer and Sphinx 7.3 or newer. | ||
| 5 | 5 | ||
| 6 | 6 | Note that when adopting this theme, you're also borrowing an element of the | |
| 7 | 7 | trust and credibility established by the CPython core developers over the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ description = "The Sphinx theme for the CPython docs and related projects" | |||
| 10 | 10 | readme = "README.md" | |
| 11 | 11 | license.file = "LICENSE" | |
| 12 | 12 | authors = [ { name = "PyPA", email = "distutils-sig@python.org" } ] | |
| 13 | - requires-python = ">=3.9" | ||
| 13 | + requires-python = ">=3.10" | ||
| 14 | 14 | classifiers = [ | |
| 15 | 15 | "Development Status :: 5 - Production/Stable", | |
| 16 | 16 | "Framework :: Sphinx :: Theme", | |
@@ -19,7 +19,6 @@ classifiers = [ | |||
| 19 | 19 | "Operating System :: OS Independent", | |
| 20 | 20 | "Programming Language :: Python", | |
| 21 | 21 | "Programming Language :: Python :: 3 :: Only", | |
| 22 | - "Programming Language :: Python :: 3.9", | ||
| 23 | 22 | "Programming Language :: Python :: 3.10", | |
| 24 | 23 | "Programming Language :: Python :: 3.11", | |
| 25 | 24 | "Programming Language :: Python :: 3.12", | |
@@ -30,7 +29,7 @@ classifiers = [ | |||
| 30 | 29 | dynamic = [ "version" ] | |
| 31 | 30 | ||
| 32 | 31 | dependencies = [ | |
| 33 | - "sphinx>=3.4", | ||
| 32 | + "sphinx>=7.3", | ||
| 34 | 33 | ] | |
| 35 | 34 | ||
| 36 | 35 | urls.Code = "https://github.com/python/python-docs-theme" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,16 +1,9 @@ | |||
| 1 | 1 | from __future__ import annotations | |
| 2 | 2 | ||
| 3 | - import hashlib | ||
| 4 | - from functools import cache | ||
| 5 | 3 | from pathlib import Path | |
| 6 | 4 | ||
| 7 | - import sphinx.application | ||
| 8 | - from sphinx.builders.html import StandaloneHTMLBuilder | ||
| 9 | - | ||
| 10 | 5 | TYPE_CHECKING = False | |
| 11 | 6 | if TYPE_CHECKING: | |
| 12 | - from typing import Any | ||
| 13 | - | ||
| 14 | 7 | from sphinx.application import Sphinx | |
| 15 | 8 | from sphinx.util.typing import ExtensionMetadata | |
| 16 | 9 | ||
@@ -19,53 +12,11 @@ | |||
| 19 | 12 | THEME_PATH = Path(__file__).resolve().parent | |
| 20 | 13 | ||
| 21 | 14 | ||
| 22 | - @cache | ||
| 23 | - def _asset_hash(path: str) -> str: | ||
| 24 | - """Append a `?digest=` to an url based on the file content.""" | ||
| 25 | - full_path = THEME_PATH / path.replace("_static/", "static/") | ||
| 26 | - digest = hashlib.sha1(full_path.read_bytes()).hexdigest() | ||
| 27 | - | ||
| 28 | - return f"{path}?digest={digest}" | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - def _add_asset_hashes(static: list[str], add_digest_to: list[str]) -> None: | ||
| 32 | - for asset in add_digest_to: | ||
| 33 | - index = static.index(asset) | ||
| 34 | - static[index].filename = _asset_hash(asset) # type: ignore[attr-defined] | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - def _html_page_context( | ||
| 38 | - app: sphinx.application.Sphinx, | ||
| 39 | - pagename: str, | ||
| 40 | - templatename: str, | ||
| 41 | - context: dict[str, Any], | ||
| 42 | - doctree: Any, | ||
| 43 | - ) -> None: | ||
| 44 | - if app.config.html_theme != "python_docs_theme": | ||
| 45 | - return | ||
| 46 | - | ||
| 47 | - assert isinstance(app.builder, StandaloneHTMLBuilder) | ||
| 48 | - | ||
| 49 | - if (4,) <= sphinx.version_info < (7, 1) and "css_files" in context: | ||
| 50 | - if "_static/pydoctheme.css" not in context["css_files"]: | ||
| 51 | - raise ValueError( | ||
| 52 | - "This documentation is not using `pydoctheme.css` as the stylesheet. " | ||
| 53 | - "If you have set `html_style` in your conf.py file, remove it." | ||
| 54 | - ) | ||
| 55 | - | ||
| 56 | - _add_asset_hashes( | ||
| 57 | - context["css_files"], | ||
| 58 | - ["_static/pydoctheme.css"], | ||
| 59 | - ) | ||
| 60 | - | ||
| 61 | - | ||
| 62 | 15 | def setup(app: Sphinx) -> ExtensionMetadata: | |
| 63 | - app.require_sphinx("3.4") | ||
| 16 | + app.require_sphinx("7.3") | ||
| 64 | 17 | ||
| 65 | 18 | app.add_html_theme("python_docs_theme", str(THEME_PATH)) | |
| 66 | 19 | ||
| 67 | - app.connect("html-page-context", _html_page_context) | ||
| 68 | - | ||
| 69 | 20 | return { | |
| 70 | 21 | "version": __version__, | |
| 71 | 22 | "parallel_read_safe": True, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - @import url('classic.css'); | ||
| 2 | - | ||
| 3 | 1 | /* Common colours */ | |
| 4 | 2 | :root { | |
| 5 | 3 | --good-color: rgb(41 100 51); | |
@@ -200,16 +198,6 @@ div.sphinxsidebar input[type='text'] { | |||
| 200 | 198 | display: flex; | |
| 201 | 199 | justify-content: center; | |
| 202 | 200 | align-items: center; | |
| 203 | - /* Sphinx 4.x and earlier compat */ | ||
| 204 | - height: 100%; | ||
| 205 | - background-color: #CCCCCC; | ||
| 206 | - margin-left: 0; | ||
| 207 | - color: #444444; | ||
| 208 | - font-size: 1.2em; | ||
| 209 | - cursor: pointer; | ||
| 210 | - padding-top: 1px; | ||
| 211 | - float: none; | ||
| 212 | - /* after Sphinx 4.x and earlier is dropped, only the below is needed */ | ||
| 213 | 201 | width: 12px; | |
| 214 | 202 | min-width: 12px; | |
| 215 | 203 | border-radius: 0 5px 5px 0; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,39 @@ | |||
| 1 | + [theme] | ||
| 2 | + inherit = "default" | ||
| 3 | + stylesheets = [ | ||
| 4 | + "classic.css", | ||
| 5 | + "pydoctheme.css", | ||
| 6 | + ] | ||
| 7 | + pygments_style = { default = "default", dark = "monokai" } | ||
| 8 | + | ||
| 9 | + [options] | ||
| 10 | + bodyfont = "-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif" | ||
| 11 | + headfont = "-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif" | ||
| 12 | + footerbgcolor = "white" | ||
| 13 | + footertextcolor = "#555555" | ||
| 14 | + relbarbgcolor = "white" | ||
| 15 | + relbartextcolor = "#666666" | ||
| 16 | + relbarlinkcolor = "#444444" | ||
| 17 | + sidebarbgcolor = "white" | ||
| 18 | + sidebartextcolor = "#444444" | ||
| 19 | + sidebarlinkcolor = "#444444" | ||
| 20 | + sidebarbtncolor = "#cccccc" | ||
| 21 | + bgcolor = "white" | ||
| 22 | + textcolor = "#222222" | ||
| 23 | + linkcolor = "#0090c0" | ||
| 24 | + visitedlinkcolor = "#00608f" | ||
| 25 | + headtextcolor = "#1a1a1a" | ||
| 26 | + headbgcolor = "white" | ||
| 27 | + headlinkcolor = "#aaaaaa" | ||
| 28 | + codebgcolor = "#eeffcc" | ||
| 29 | + codetextcolor = "#333333" | ||
| 30 | + | ||
| 31 | + hosted_on = "" | ||
| 32 | + issues_url = "" | ||
| 33 | + license_url = "" | ||
| 34 | + root_name = "Python" | ||
| 35 | + root_url = "https://www.python.org/" | ||
| 36 | + root_icon = "py.svg" | ||
| 37 | + root_icon_alt_text = "Python logo" | ||
| 38 | + root_include_title = "True" | ||
| 39 | + copyright_url = "" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments