Skip to content

Commit ef296e2

Browse files
authored
Do not append asset hashes on Sphinx 7.1+
The relevant functionality has been added to Sphinx natively.
1 parent 4dbc102 commit ef296e2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python_docs_theme/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55
from typing import Any, Dict, List
66

7+
import sphinx
78
import sphinx.application
89
from sphinx.builders.html import StandaloneHTMLBuilder
910

@@ -20,6 +21,11 @@ def _asset_hash(path: str) -> str:
2021

2122

2223
def _add_asset_hashes(static: List[str], add_digest_to: List[str]) -> None:
24+
if sphinx.version_info >= (7, 1):
25+
# https://github.com/sphinx-doc/sphinx/pull/11415 added the relevant
26+
# functionality to Sphinx, so we don't need to do anything.
27+
return
28+
2329
for asset in add_digest_to:
2430
index = static.index(asset)
2531
static[index].filename = _asset_hash(asset) # type: ignore

0 commit comments

Comments
 (0)