Sphinx 7.3.6__py3-none-any.whl → 7.3.7__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,6 +1,6 @@
1
1
  """The Sphinx documentation toolchain."""
2
2
 
3
- __version__ = '7.3.6'
3
+ __version__ = '7.3.7'
4
4
  __display_version__ = __version__ # used for command line version
5
5
 
6
6
  # Keep this file executable as-is in Python 3!
@@ -28,7 +28,7 @@ warnings.filterwarnings(
28
28
  #:
29
29
  #: .. versionadded:: 1.2
30
30
  #: Before version 1.2, check the string ``sphinx.__version__``.
31
- version_info = (7, 3, 6, 'final', 0)
31
+ version_info = (7, 3, 7, 'final', 0)
32
32
 
33
33
  package_dir = path.abspath(path.dirname(__file__))
34
34
 
@@ -47,6 +47,7 @@ from sphinx.domains.python._object import ( # NoQA: F401
47
47
  PyGroupedField,
48
48
  PyTypedField,
49
49
  PyXrefMixin,
50
+ py_sig_re,
50
51
  )
51
52
 
52
53
  logger = logging.getLogger(__name__)
sphinx/theming.py CHANGED
@@ -32,6 +32,7 @@ else:
32
32
  from importlib_metadata import entry_points
33
33
 
34
34
  if TYPE_CHECKING:
35
+ from collections.abc import Callable
35
36
  from typing import TypedDict
36
37
 
37
38
  from typing_extensions import Required
@@ -120,7 +121,17 @@ class Theme:
120
121
  elif section == 'options':
121
122
  value = self._options.get(name, default)
122
123
  else:
123
- value = _NO_DEFAULT
124
+ # https://github.com/sphinx-doc/sphinx/issues/12305
125
+ # For backwards compatibility when attempting to read a value
126
+ # from an unsupported configuration section.
127
+ # xref: RemovedInSphinx80Warning
128
+ msg = __(
129
+ 'Theme configuration sections other than [theme] and [options] '
130
+ 'are not supported, returning the default value instead '
131
+ '(tried to get a value from %r)'
132
+ )
133
+ logger.info(msg % section)
134
+ value = default
124
135
  if value is _NO_DEFAULT:
125
136
  msg = __('setting %s.%s occurs in none of the searched theme configs') % (
126
137
  section,
@@ -156,6 +167,7 @@ class HTMLThemeFactory:
156
167
  def __init__(self, app: Sphinx) -> None:
157
168
  self._app = app
158
169
  self._themes = app.registry.html_themes
170
+ self._entry_point_themes: dict[str, Callable[[], None]] = {}
159
171
  self._load_builtin_themes()
160
172
  if getattr(app.config, 'html_theme_path', None):
161
173
  self._load_additional_themes(app.config.html_theme_path)
@@ -183,8 +195,16 @@ class HTMLThemeFactory:
183
195
  for entry_point in entry_points(group='sphinx.html_themes'):
184
196
  if entry_point.name in self._themes:
185
197
  continue # don't overwrite loaded themes
186
- self._app.registry.load_extension(self._app, entry_point.module)
187
- _config_post_init(self._app, self._app.config)
198
+
199
+ def _load_theme_closure(
200
+ # bind variables in the function definition
201
+ app: Sphinx = self._app,
202
+ theme_module: str = entry_point.module,
203
+ ) -> None:
204
+ app.setup_extension(theme_module)
205
+ _config_post_init(app, app.config)
206
+
207
+ self._entry_point_themes[entry_point.name] = _load_theme_closure
188
208
 
189
209
  @staticmethod
190
210
  def _find_themes(theme_path: str) -> dict[str, str]:
@@ -217,10 +237,18 @@ class HTMLThemeFactory:
217
237
 
218
238
  def create(self, name: str) -> Theme:
219
239
  """Create an instance of theme."""
240
+ if name in self._entry_point_themes:
241
+ # Load a deferred theme from an entry point
242
+ entry_point_loader = self._entry_point_themes[name]
243
+ entry_point_loader()
220
244
  if name not in self._themes:
221
245
  raise ThemeError(__('no theme named %r found (missing theme.toml?)') % name)
222
246
 
223
- themes, theme_dirs, tmp_dirs = _load_theme_with_ancestors(self._themes, name)
247
+ themes, theme_dirs, tmp_dirs = _load_theme_with_ancestors(
248
+ name,
249
+ self._themes,
250
+ self._entry_point_themes,
251
+ )
224
252
  return Theme(name, configs=themes, paths=theme_dirs, tmp_dirs=tmp_dirs)
225
253
 
226
254
 
@@ -235,7 +263,10 @@ def _is_archived_theme(filename: str, /) -> bool:
235
263
 
236
264
 
237
265
  def _load_theme_with_ancestors(
238
- theme_paths: dict[str, str], name: str, /
266
+ name: str,
267
+ theme_paths: dict[str, str],
268
+ entry_point_themes: dict[str, Callable[[], None]],
269
+ /,
239
270
  ) -> tuple[dict[str, _ConfigFile], list[str], list[str]]:
240
271
  themes: dict[str, _ConfigFile] = {}
241
272
  theme_dirs: list[str] = []
@@ -253,6 +284,10 @@ def _load_theme_with_ancestors(
253
284
  if inherit in themes:
254
285
  msg = __('The %r theme has circular inheritance') % name
255
286
  raise ThemeError(msg)
287
+ if inherit in entry_point_themes and inherit not in theme_paths:
288
+ # Load a deferred theme from an entry point
289
+ entry_point_loader = entry_point_themes[inherit]
290
+ entry_point_loader()
256
291
  if inherit not in theme_paths:
257
292
  msg = __(
258
293
  'The %r theme inherits from %r, which is not a loaded theme. '
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Sphinx
3
- Version: 7.3.6
3
+ Version: 7.3.7
4
4
  Summary: Python documentation generator
5
5
  Author-email: Georg Brandl <georg@python.org>
6
6
  Requires-Python: >=3.9
@@ -1,4 +1,4 @@
1
- sphinx/__init__.py,sha256=LTeGLLcGjWSnQHAbpVTJWMAQAhCy-TQMYkBehF_ituk,1694
1
+ sphinx/__init__.py,sha256=7gy5LypY6hNPIaKbHRXv-Uk3PF6lqIRleU1xbmRaHZs,1694
2
2
  sphinx/__main__.py,sha256=wIifwXlZHdi4gtQmkJ6KF0BsflvD9o0Wd5nARTdJc8A,127
3
3
  sphinx/addnodes.py,sha256=EQTIi9Zta6DaNa-2WGE3l9AVjdp7WzwwrfwRnax8vXE,18707
4
4
  sphinx/application.py,sha256=ICEmiMaOt4m0Wl2GBeHHulbZNcDvEpXMyfVuzDxcEhk,56266
@@ -16,7 +16,7 @@ sphinx/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  sphinx/pygments_styles.py,sha256=0RJn6WC7rPnQu7BDqrqb0gkJcb3elRfizGVBW9bcmRE,2861
17
17
  sphinx/registry.py,sha256=LCWv2mDKNiN6IaE5tgUeWzmff9SFN7UWYwEN3QxbK4Q,22593
18
18
  sphinx/roles.py,sha256=8f9AJ8gUuOFrNzdgX6yhdE-Wc8ZeufoieMP4oL5lCAU,16964
19
- sphinx/theming.py,sha256=k71Gp6K9OrV-waG-dF3ZwtKJ9PnXCb-Do_teQUO_fvQ,18864
19
+ sphinx/theming.py,sha256=MhnxVHWE8CpP9fbmp7CI1UBBJhzamfJmif501M82ozw,20308
20
20
  sphinx/versioning.py,sha256=Kro82eLQvxD8RQShAipw_1GcwivuOrOO1SsDIigGWz0,5942
21
21
  sphinx/builders/__init__.py,sha256=E9Z1LeE_3lCq0vPs1Po2xliMkXF0awcRiK87C_9ZVgw,26851
22
22
  sphinx/builders/_epub_base.py,sha256=gtXo-PcmxLZs7t4VrETy5Ek1rOA5Uk35YNEyUtMvB24,29021
@@ -65,7 +65,7 @@ sphinx/domains/cpp/_ast.py,sha256=P2yAf7gCCtUSZrMdDn6m9dd6-MhhAcvRFQtDGwqO23w,13
65
65
  sphinx/domains/cpp/_ids.py,sha256=-h42RrmFnuq4AyZ0EVHtAk_H_9Umrca24Tu-w73TKCw,18028
66
66
  sphinx/domains/cpp/_parser.py,sha256=EaKoUzpUgZnAFKZYfOBl_-Iw8z2LdYxfZtdWglpSE3Q,88250
67
67
  sphinx/domains/cpp/_symbol.py,sha256=pyjUC0tvGs_3j8Qlafw5u9EUAQyPqj5ukbbE8LUkEUo,48775
68
- sphinx/domains/python/__init__.py,sha256=2xt9rkJsIWmcji1QfwYkMDTXEsJcMO9fvmruZ4BwtbU,34071
68
+ sphinx/domains/python/__init__.py,sha256=jP8eICP3-1SQHxDm55061og_jIEEqg7S0A2q8VsgQi0,34086
69
69
  sphinx/domains/python/_annotations.py,sha256=bLay4nHo1L7KxfX2exE2ttTLqwOnMBDVEg7r6v_YeSY,22302
70
70
  sphinx/domains/python/_object.py,sha256=Kds5Z-5bNNh2dIgStb6bEu0l9y-bC8Rga4jz1lzwGwU,17000
71
71
  sphinx/domains/std/__init__.py,sha256=rQ4gJSs74w7PQDjJ4Qu2vBcr0_kpXyUXA897BOjlEQc,46277
@@ -574,8 +574,8 @@ sphinx/writers/manpage.py,sha256=nLPgs3A5mVouhjiY2Olfoxh7PTFUZc1stHhThGDRSM4,161
574
574
  sphinx/writers/texinfo.py,sha256=YaVcaaK533HWd14FJkBJwkZZNL5Yh6rv2rcFrkhR4SU,53220
575
575
  sphinx/writers/text.py,sha256=HEiYXsWXO9QVOazg2V3D0ehGTnK38dAtYP9v0rst684,42964
576
576
  sphinx/writers/xml.py,sha256=NyDl82hCFSRiHrCZV6vBfn4AsAyXH6khtSJEfhOX8a0,1502
577
- sphinx-7.3.6.dist-info/entry_points.txt,sha256=KU_c9jqXj7yyZylSz11XRIXG3gAZApQa0d5DmcfyA7M,188
578
- sphinx-7.3.6.dist-info/LICENSE.rst,sha256=HdZPUFcmQaLySBc9fKvRC5aOUNkxL9Gz5py0p6XGDk4,3135
579
- sphinx-7.3.6.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
580
- sphinx-7.3.6.dist-info/METADATA,sha256=FMYzRS9LhpvrlDPgc2zyDugkBf5CHN5N4YEqQqK67gk,6021
581
- sphinx-7.3.6.dist-info/RECORD,,
577
+ sphinx-7.3.7.dist-info/entry_points.txt,sha256=KU_c9jqXj7yyZylSz11XRIXG3gAZApQa0d5DmcfyA7M,188
578
+ sphinx-7.3.7.dist-info/LICENSE.rst,sha256=HdZPUFcmQaLySBc9fKvRC5aOUNkxL9Gz5py0p6XGDk4,3135
579
+ sphinx-7.3.7.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
580
+ sphinx-7.3.7.dist-info/METADATA,sha256=5b_W8GYzkdC-boJ-961YHOC-uQB_R88uBnhgso9tE6A,6021
581
+ sphinx-7.3.7.dist-info/RECORD,,
File without changes