Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c199fa

Browse files
committed
Require Sphinx 7.2+
1 parent1d36ee8 commit7c199fa

File tree

5 files changed

+3
-163
lines changed

5 files changed

+3
-163
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Python Docs Sphinx Theme
22

33
This is the theme for the Python documentation.
4-
It requires Python 3.10 or newer and Sphinx3.4 or newer.
4+
It requires Python 3.10 or newer and Sphinx7.2 or newer.
55

66
Note that when adopting this theme, you're also borrowing an element of the
77
trust and credibility established by the CPython core developers over the

‎pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ classifiers = [
2828
"Topic :: Software Development :: Documentation",
2929
]
3030
dependencies = [
31-
"sphinx>=3.4",
31+
"sphinx>=7.2",
3232
]
3333

3434
urls.Code ="https://github.com/python/python-docs-theme"

‎python_docs_theme/__init__.py

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,17 @@
11
from __future__importannotations
22

3-
importhashlib
43
importos
5-
fromfunctoolsimportcache
64
frompathlibimportPath
7-
fromtypingimportAny
8-
9-
importsphinx.application
10-
fromsphinx.builders.htmlimportStandaloneHTMLBuilder
115

126
THEME_PATH=Path(__file__).parent.resolve()
137

148

15-
@cache
16-
def_asset_hash(path:str)->str:
17-
"""Append a `?digest=` to an url based on the file content."""
18-
full_path=THEME_PATH/path.replace("_static/","static/")
19-
digest=hashlib.sha1(full_path.read_bytes()).hexdigest()
20-
21-
returnf"{path}?digest={digest}"
22-
23-
24-
def_add_asset_hashes(static:list[str],add_digest_to:list[str])->None:
25-
forassetinadd_digest_to:
26-
index=static.index(asset)
27-
static[index].filename=_asset_hash(asset)# type: ignore[attr-defined]
28-
29-
30-
def_html_page_context(
31-
app:sphinx.application.Sphinx,
32-
pagename:str,
33-
templatename:str,
34-
context:dict[str,Any],
35-
doctree:Any,
36-
)->None:
37-
ifapp.config.html_theme!="python_docs_theme":
38-
return
39-
40-
assertisinstance(app.builder,StandaloneHTMLBuilder)
41-
42-
if (4,)<=sphinx.version_info< (7,1)and"css_files"incontext:
43-
if"_static/pydoctheme.css"notincontext["css_files"]:
44-
raiseValueError(
45-
"This documentation is not using `pydoctheme.css` as the stylesheet. "
46-
"If you have set `html_style` in your conf.py file, remove it."
47-
)
48-
49-
_add_asset_hashes(
50-
context["css_files"],
51-
["_static/pydoctheme.css"],
52-
)
53-
54-
559
defsetup(app):
56-
app.require_sphinx("3.4")
10+
app.require_sphinx("7.2")
5711

5812
current_dir=os.path.abspath(os.path.dirname(__file__))
5913
app.add_html_theme("python_docs_theme",current_dir)
6014

61-
app.connect("html-page-context",_html_page_context)
62-
6315
return {
6416
"version":"2024.12",
6517
"parallel_read_safe":True,

‎python_docs_theme/static/pydoctheme.css

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -191,28 +191,11 @@ div.sphinxsidebar input[type='text'] {
191191
}
192192

193193
#sidebarbutton {
194-
/* Sphinx 4.x and earlier compat */
195-
height:100%;
196-
background-color:#CCCCCC;
197-
margin-left:0;
198-
color:#444444;
199-
font-size:1.2em;
200-
cursor: pointer;
201-
padding-top:1px;
202-
float: right;
203-
display: table;
204-
/* after Sphinx 4.x and earlier is dropped, only the below is needed */
205194
width:12px;
206195
border-radius:05px5px0;
207196
border-left: none;
208197
}
209198

210-
#sidebarbuttonspan {
211-
/* Sphinx 4.x and earlier compat */
212-
display: table-cell;
213-
vertical-align: middle;
214-
}
215-
216199
#sidebarbutton:hover {
217200
background-color:#AAAAAA;
218201
}

‎python_docs_theme/static/sidebar.js_t

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp