Sphinx 8.2.1__py3-none-any.whl → 8.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Sphinx might be problematic. Click here for more details.

sphinx/__init__.py CHANGED
@@ -1,24 +1,25 @@
1
1
  """The Sphinx documentation toolchain."""
2
2
 
3
- from __future__ import annotations
4
-
5
- __version__ = '8.2.1'
6
- __display_version__ = __version__ # used for command line version
7
-
8
3
  # Keep this file executable as-is in Python 3!
9
4
  # (Otherwise getting the version out of it when packaging is impossible.)
10
5
 
11
- import os
6
+ from __future__ import annotations
7
+
12
8
  import warnings
13
9
 
14
- from sphinx.util._pathlib import _StrPath
10
+ # work around flit error in parsing annotated assignments
11
+ try:
12
+ from sphinx.util._pathlib import _StrPath
13
+ except ImportError:
14
+ from pathlib import Path as _StrPath # type: ignore[assignment]
15
+
16
+ TYPE_CHECKING = False
17
+ if TYPE_CHECKING:
18
+ from typing import Final
15
19
 
16
- # by default, all DeprecationWarning under sphinx package will be emit.
17
- # Users can avoid this by using environment variable: PYTHONWARNINGS=
18
- if 'PYTHONWARNINGS' not in os.environ:
19
- from sphinx.deprecation import RemovedInNextVersionWarning
20
+ __version__: Final = '8.3.0'
21
+ __display_version__: Final = __version__ # used for command line version
20
22
 
21
- warnings.filterwarnings('default', category=RemovedInNextVersionWarning)
22
23
  warnings.filterwarnings(
23
24
  'ignore',
24
25
  'The frontend.Option class .*',
@@ -34,9 +35,9 @@ warnings.filterwarnings(
34
35
  #:
35
36
  #: .. versionadded:: 1.2
36
37
  #: Before version 1.2, check the string ``sphinx.__version__``.
37
- version_info = (8, 2, 1, 'final', 0)
38
+ version_info: Final = (8, 2, 2, 'final', 0)
38
39
 
39
- package_dir = _StrPath(__file__).resolve().parent
40
+ package_dir: Final = _StrPath(__file__).resolve().parent
40
41
 
41
42
  _in_development = False
42
43
  if _in_development:
@@ -45,14 +46,14 @@ if _in_development:
45
46
 
46
47
  try:
47
48
  if ret := subprocess.run(
48
- ['git', 'rev-parse', '--short', 'HEAD'], # NoQA: S607
49
- cwd=package_dir,
49
+ ('git', 'rev-parse', '--short', 'HEAD'),
50
50
  capture_output=True,
51
51
  check=False,
52
- encoding='ascii',
52
+ cwd=package_dir,
53
+ encoding='utf-8',
53
54
  errors='surrogateescape',
54
55
  ).stdout:
55
- __display_version__ += '+/' + ret.strip()
56
+ __display_version__ += f'+/{ret.strip()}' # type: ignore[misc]
56
57
  del ret
57
58
  finally:
58
59
  del subprocess
sphinx/application.py CHANGED
@@ -1507,6 +1507,7 @@ class Sphinx:
1507
1507
  elif loading_method == 'defer':
1508
1508
  kwargs['defer'] = 'defer'
1509
1509
 
1510
+ filename = filename or ''
1510
1511
  self.registry.add_js_file(filename, priority=priority, **kwargs)
1511
1512
  with contextlib.suppress(AttributeError):
1512
1513
  self.builder.add_js_file( # type: ignore[attr-defined]
sphinx/deprecation.py CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import os
5
6
  import warnings
6
7
 
7
8
 
@@ -16,6 +17,12 @@ class RemovedInSphinx10Warning(PendingDeprecationWarning):
16
17
  RemovedInNextVersionWarning = RemovedInSphinx90Warning
17
18
 
18
19
 
20
+ # By default, all Sphinx deprecation warnings will be emitted.
21
+ # To avoid this, set the environment variable: PYTHONWARNINGS=
22
+ if 'PYTHONWARNINGS' not in os.environ:
23
+ warnings.filterwarnings('default', category=RemovedInNextVersionWarning)
24
+
25
+
19
26
  def _deprecation_warning(
20
27
  module: str,
21
28
  attribute: str,
@@ -217,7 +217,6 @@ def _parse_module_options(
217
217
  dest_dir=dest_path,
218
218
  module_path=module_path,
219
219
  exclude_pattern=exclude_patterns,
220
- automodule_options=automodule_options,
221
220
  max_depth=max_depth,
222
221
  quiet=True,
223
222
  follow_links=bool_options['follow_links'],
@@ -226,6 +225,8 @@ def _parse_module_options(
226
225
  no_headings=bool_options['no_headings'],
227
226
  module_first=bool_options['module_first'],
228
227
  implicit_namespaces=bool_options['implicit_namespaces'],
228
+ automodule_options=automodule_options,
229
+ header=module_path.name,
229
230
  )
230
231
 
231
232
 
sphinx/locale/__init__.py CHANGED
@@ -8,11 +8,15 @@ from gettext import NullTranslations, translation
8
8
  from pathlib import Path
9
9
  from typing import TYPE_CHECKING
10
10
 
11
+ from sphinx import package_dir
12
+
11
13
  if TYPE_CHECKING:
12
14
  import os
13
15
  from collections.abc import Callable, Iterable
14
16
  from typing import Any
15
17
 
18
+ _LOCALE_DIR = Path(package_dir, 'locale')
19
+
16
20
 
17
21
  class _TranslationProxy:
18
22
  """The proxy implementation attempts to be as complete as possible, so that
@@ -140,9 +144,6 @@ def init(
140
144
  return translator, has_translation
141
145
 
142
146
 
143
- _LOCALE_DIR = Path(__file__).resolve().parent
144
-
145
-
146
147
  def init_console(
147
148
  locale_dir: str | os.PathLike[str] | None = None,
148
149
  catalog: str = 'sphinx',
sphinx/search/zh.py CHANGED
@@ -4,19 +4,33 @@ from __future__ import annotations
4
4
 
5
5
  import re
6
6
  from pathlib import Path
7
+ from typing import TYPE_CHECKING
7
8
 
8
9
  import snowballstemmer
9
10
 
10
11
  from sphinx.search import SearchLanguage
11
12
 
13
+ if TYPE_CHECKING:
14
+ from collections.abc import Iterator
15
+
12
16
  try:
13
17
  import jieba # type: ignore[import-not-found]
14
-
15
- JIEBA = True
16
- JIEBA_DEFAULT_DICT = Path(jieba.__file__).parent / jieba.DEFAULT_DICT_NAME
18
+ from jieba import cut_for_search
19
+ from jieba import load_userdict as jieba_load_userdict
17
20
  except ImportError:
18
- JIEBA = False
19
- JIEBA_DEFAULT_DICT = Path()
21
+ JIEBA_DEFAULT_DICT = ''
22
+
23
+ def jieba_load_userdict(f: str) -> None:
24
+ pass
25
+
26
+ def cut_for_search(sentence: str, HMM: bool = True) -> Iterator[str]:
27
+ yield from ()
28
+
29
+ else:
30
+ JIEBA_DEFAULT_DICT = (
31
+ Path(jieba.__file__, '..', jieba.DEFAULT_DICT_NAME).resolve().as_posix()
32
+ )
33
+ del jieba
20
34
 
21
35
  english_stopwords = {
22
36
  'a', 'and', 'are', 'as', 'at',
@@ -231,18 +245,14 @@ class SearchChinese(SearchLanguage):
231
245
  self.latin_terms: set[str] = set()
232
246
 
233
247
  def init(self, options: dict[str, str]) -> None:
234
- if JIEBA:
235
- dict_path = options.get('dict', JIEBA_DEFAULT_DICT)
236
- if dict_path and Path(dict_path).is_file():
237
- jieba.load_userdict(dict_path)
248
+ dict_path = options.get('dict', JIEBA_DEFAULT_DICT)
249
+ if dict_path and Path(dict_path).is_file():
250
+ jieba_load_userdict(str(dict_path))
238
251
 
239
252
  self.stemmer = snowballstemmer.stemmer('english')
240
253
 
241
254
  def split(self, input: str) -> list[str]:
242
- if JIEBA:
243
- chinese: list[str] = list(jieba.cut_for_search(input))
244
- else:
245
- chinese = []
255
+ chinese: list[str] = list(cut_for_search(input))
246
256
 
247
257
  latin1 = [term.strip() for term in self.latin1_letters.findall(input)]
248
258
  self.latin_terms.update(latin1)
sphinx/util/__init__.py CHANGED
@@ -62,6 +62,13 @@ def __getattr__(name: str) -> Any:
62
62
  obj: Callable[..., Any]
63
63
  mod: ModuleType
64
64
 
65
+ if name == 'console':
66
+ # Explicit temporary workaround for nbsphinx implicit imports.
67
+ # https://github.com/sphinx-doc/sphinx/issues/13352
68
+ import sphinx.util.console as mod
69
+
70
+ return mod
71
+
65
72
  # RemovedInSphinx90Warning
66
73
  if name == 'split_index_msg':
67
74
  from sphinx.util.index_entries import split_index_msg as obj
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Sphinx
3
- Version: 8.2.1
3
+ Version: 8.3.0
4
4
  Summary: Python documentation generator
5
5
  Author-email: Adam Turner <aa-turner@users.noreply.github.com>, Georg Brandl <georg@python.org>
6
6
  Requires-Python: >=3.11
@@ -69,7 +69,7 @@ Requires-Dist: roman-numerals-py>=1.0.0
69
69
  Requires-Dist: packaging>=23.0
70
70
  Requires-Dist: colorama>=0.4.6; sys_platform == 'win32'
71
71
  Requires-Dist: sphinxcontrib-websupport ; extra == "docs"
72
- Requires-Dist: ruff==0.9.7 ; extra == "lint"
72
+ Requires-Dist: ruff==0.9.9 ; extra == "lint"
73
73
  Requires-Dist: mypy==1.15.0 ; extra == "lint"
74
74
  Requires-Dist: sphinx-lint>=0.9 ; extra == "lint"
75
75
  Requires-Dist: types-colorama==0.4.15.20240311 ; extra == "lint"
@@ -79,7 +79,7 @@ Requires-Dist: types-Pillow==10.2.0.20240822 ; extra == "lint"
79
79
  Requires-Dist: types-Pygments==2.19.0.20250219 ; extra == "lint"
80
80
  Requires-Dist: types-requests==2.32.0.20241016 ; extra == "lint"
81
81
  Requires-Dist: types-urllib3==1.26.25.14 ; extra == "lint"
82
- Requires-Dist: pyright==1.1.394 ; extra == "lint"
82
+ Requires-Dist: pyright==1.1.395 ; extra == "lint"
83
83
  Requires-Dist: pytest>=8.0 ; extra == "lint"
84
84
  Requires-Dist: pypi-attestations==0.0.21 ; extra == "lint"
85
85
  Requires-Dist: betterproto==2.0.0b6 ; extra == "lint"
@@ -1,9 +1,9 @@
1
- sphinx/__init__.py,sha256=sTmq1a5LGaVMSkcGYeVmBgSPCqQPu0TgPVowXHaWFCY,1789
1
+ sphinx/__init__.py,sha256=qwy6FBnG2snAGt4jMEbXpJ6nXgR5f8nUFJxbT00Z0Ys,1719
2
2
  sphinx/__main__.py,sha256=PYSg7M8rY5VgULh3SJEaYMWsB1YFJw7f40b50yW8NEE,163
3
3
  sphinx/addnodes.py,sha256=QFvrCg9bGgH_zsGFVeUzGWcvqIQXtC-b7jXUYZEJRsk,18502
4
- sphinx/application.py,sha256=FgR54sWE9-hH548ZUbe3x0v_NlRRUAZ4JjorhwDF8eg,66893
4
+ sphinx/application.py,sha256=gjI_Sv3JARUUaGSPvaJlJ5TM8_tckDVnh0dBkSxZcaI,66927
5
5
  sphinx/config.py,sha256=7Raa_GVF6S0uZWDbYL6VkG9N8OlKHM7g5s5CPgyHNtU,34297
6
- sphinx/deprecation.py,sha256=U4BIydQiXjU3seaMOORp6bVeVleg-3xcAl_iU7bu2eA,2521
6
+ sphinx/deprecation.py,sha256=rgOkaj4FTR1ZLdrxAxh_DyrYWyXGFlCmUXclkvBNlN4,2775
7
7
  sphinx/errors.py,sha256=lk9KPV3Grp64NwoU81JhK0rr1ybBS_d2iaXyhosVrSg,3413
8
8
  sphinx/events.py,sha256=NXjTchmTJN8VKGcWo47EJmopcIboEBXS5MT6namRpL0,12120
9
9
  sphinx/extension.py,sha256=qnA_a5SlIz5-3RcHAJ1tpLnBeznVEQzkAPh7WIEAAxU,3192
@@ -106,7 +106,7 @@ sphinx/ext/viewcode.py,sha256=GSfhXGX2EBoVjAG0SDv7kkUSktKUwRRBc-xPmvpDi-w,15109
106
106
  sphinx/ext/apidoc/__init__.py,sha256=rvtSje1ayQSBwbVYJwkSPZV_NrdZiqdfvgy_dYOfAhI,2227
107
107
  sphinx/ext/apidoc/__main__.py,sha256=-kCJWW_BL2zpvylBkK3U_XqVBNKEAETeghxR_UHsJvw,182
108
108
  sphinx/ext/apidoc/_cli.py,sha256=MeApBSdy14-cXJiuEJeY1E366xFFfqSuvrYNOatcUHo,10182
109
- sphinx/ext/apidoc/_extension.py,sha256=OjrJFA9HwEJrK392IayeGa4tnS5olRD_5FO58vxlpdw,7505
109
+ sphinx/ext/apidoc/_extension.py,sha256=Ng-L5I0o7C7kivph13IIndEqHO3PkhxTVozxp5drg8U,7538
110
110
  sphinx/ext/apidoc/_generate.py,sha256=EAhpB2PUwsjdPNV6UN8KCOXbgWwaeOdmV577amk29iU,11909
111
111
  sphinx/ext/apidoc/_shared.py,sha256=wer5szQBKbF1be0NBW_DW2ugMb9zWZ1MvQAQE-DYbqc,2908
112
112
  sphinx/ext/autodoc/__init__.py,sha256=gpklYg_A3gPPqyargGVHf_wWAyAJJoK4x0_5PNm3zv4,121569
@@ -129,7 +129,7 @@ sphinx/ext/intersphinx/_resolve.py,sha256=ym1WIZDG239cPuSqkOfvtyNnQFqVUW8e8YnOk8
129
129
  sphinx/ext/intersphinx/_shared.py,sha256=0xyJvKFopwAPrtxibmWaMv7Zqpby8bdrrtQxzZWAmYk,5490
130
130
  sphinx/ext/napoleon/__init__.py,sha256=UHmmL03gExDg14G9O1lV9lLaEmFD7SW8LkQGBW79btI,18649
131
131
  sphinx/ext/napoleon/docstring.py,sha256=VAWXHZDSctCco8alEsPvaAt_y2apvS3g3qVuG7QjTmE,50736
132
- sphinx/locale/__init__.py,sha256=80U_6HxueS089sipT-W0pTuKyDAkfVy3xqyHO2BrK_U,7299
132
+ sphinx/locale/__init__.py,sha256=1k1bE9OQ0bfT3bHn3KQ_xmB6Kv_3OrbBDKb3h_L6-Go,7326
133
133
  sphinx/locale/sphinx.pot,sha256=1Q8cDBljOc5019N_ALi09YIz1N3qqcCZhcjmtxpPvwk,91003
134
134
  sphinx/locale/.tx/config,sha256=WhhxMTRN6Jtvv0v4eQdX003u8JDsCtT9_Ln2n4X8eBM,165
135
135
  sphinx/locale/ar/LC_MESSAGES/sphinx.js,sha256=_HHzyE81QrF_0oZdAAN2CDGCBtacPWMVMRKPG0vlmWQ,3585
@@ -356,7 +356,7 @@ sphinx/search/ro.py,sha256=hPXwj-tUOp-MDPV4SfHMFAVFQJ96X7O0u3v6p5Ghbs0,537
356
356
  sphinx/search/ru.py,sha256=PZWcdpHAIUpBSuqSAyLhlPKrhgFOLn5gC6tlyR3gERI,7891
357
357
  sphinx/search/sv.py,sha256=MUTtDlXnbeAS26i79u-6ftqARTH0mddUJYRCg48Bdxc,3422
358
358
  sphinx/search/tr.py,sha256=Zc8yCcfrolX2XKGnKmlC046FZs3wG-GBRRFFC6i0hw4,531
359
- sphinx/search/zh.py,sha256=-VaddW4SNBRoTDdtAZrnkvFkDwG6jMSGtC-NmfuMOnE,6479
359
+ sphinx/search/zh.py,sha256=VS04e0WQ_Kaqg9C8xQi1V-WuGt4uIFk5cEqaWYUc3Oo,6748
360
360
  sphinx/search/minified-js/base-stemmer.js,sha256=A_tSOI9F30VjUWOoXxSW9tuyeYAw4iemUS7rGCKROOE,3594
361
361
  sphinx/search/minified-js/danish-stemmer.js,sha256=jZxzX8AJMWwmA55-XE9x0MA8jeWp4VslFGe1y29mEQE,3123
362
362
  sphinx/search/minified-js/dutch-stemmer.js,sha256=UEIU4hOLfXsjl0Nklym2n04Wnik9Dpj0XU2O2CFzeJ4,5529
@@ -553,7 +553,7 @@ sphinx/transforms/references.py,sha256=6z0wqnfn8D38KKInB_xv_6oFyEpfhU63ew1dhlh-R
553
553
  sphinx/transforms/post_transforms/__init__.py,sha256=x55Pz3AvOazP8njxhQxgrJ3mciBd1qYCIMDp2ZWXCiM,14335
554
554
  sphinx/transforms/post_transforms/code.py,sha256=oHZPcq-IEHP8TRCIebJXYOV-R4sONtU4YVBSqwv-x3Q,4509
555
555
  sphinx/transforms/post_transforms/images.py,sha256=gjiCYFdj25SRvb3mJR7zh6DAQZXKgpKintz7KWf7MEc,10764
556
- sphinx/util/__init__.py,sha256=ZfsbhGogFmQ3pk2GmCAK1GOhGk7Z1ir9ytxMHj6rM7E,4105
556
+ sphinx/util/__init__.py,sha256=azC1YSplYSMGdaql21qMsCQFJ3gJPau5hRQUcK4XwPc,4325
557
557
  sphinx/util/_files.py,sha256=oA22fogqLB8_a-Apc519-RdI08WkfI0zfo8vvpY61l4,3152
558
558
  sphinx/util/_importer.py,sha256=oGo_Yt-axe6M63x9akvf1UNw1tMMx1nU58TW8_MBcfQ,941
559
559
  sphinx/util/_inventory_file_reader.py,sha256=5XtzK-FBI5lQjMmYx4tg4E_T0Q9CMuVqu5hlW-R8JCk,2027
@@ -599,8 +599,8 @@ sphinx/writers/manpage.py,sha256=rwur1uSNhRsPlb4U1tXwtV3gqz-W1RD-yIw29Qmjxo4,155
599
599
  sphinx/writers/texinfo.py,sha256=WOMdKuYov6lt9PH34gsO1UbdYE48W3GdU0sZ7tw73pE,52791
600
600
  sphinx/writers/text.py,sha256=8FSF2vj0NaJHCMmHK3Rz6H8-iSMBpkyVT2VOT5-mLXA,43916
601
601
  sphinx/writers/xml.py,sha256=qaxAMR7htHmo3tQgqi9_8DD_B0HJEvz9hZH1iJwZkdk,1730
602
- sphinx-8.2.1.dist-info/entry_points.txt,sha256=KU_c9jqXj7yyZylSz11XRIXG3gAZApQa0d5DmcfyA7M,188
603
- sphinx-8.2.1.dist-info/licenses/LICENSE.rst,sha256=ZMlpGbuvOhO6oPEOQYzB_Ih2jOG5wH9be_SfD7I9sQY,1476
604
- sphinx-8.2.1.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
605
- sphinx-8.2.1.dist-info/METADATA,sha256=iiOR-gWz5zRVOAFuFRr_pc0tKEk_--n0mlrWpb14Wo8,7013
606
- sphinx-8.2.1.dist-info/RECORD,,
602
+ sphinx-8.3.0.dist-info/entry_points.txt,sha256=KU_c9jqXj7yyZylSz11XRIXG3gAZApQa0d5DmcfyA7M,188
603
+ sphinx-8.3.0.dist-info/licenses/LICENSE.rst,sha256=ZMlpGbuvOhO6oPEOQYzB_Ih2jOG5wH9be_SfD7I9sQY,1476
604
+ sphinx-8.3.0.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
605
+ sphinx-8.3.0.dist-info/METADATA,sha256=ZU6pBXhYE7oudK_qhD9QQB_vFX8AKm38JcEWUS1xPN4,7013
606
+ sphinx-8.3.0.dist-info/RECORD,,
File without changes