Sphinx 7.3.5__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.5'
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, 5, 'final', 0)
31
+ version_info = (7, 3, 7, 'final', 0)
32
32
 
33
33
  package_dir = path.abspath(path.dirname(__file__))
34
34
 
sphinx/config.py CHANGED
@@ -51,30 +51,28 @@ class ConfigValue(NamedTuple):
51
51
  rebuild: _ConfigRebuild
52
52
 
53
53
 
54
- def is_serializable(obj: object, *, _recursive_guard: frozenset[int] = frozenset()) -> bool:
55
- """Check if object is serializable or not."""
54
+ def is_serializable(obj: object, *, _seen: frozenset[int] = frozenset()) -> bool:
55
+ """Check if an object is serializable or not."""
56
56
  if isinstance(obj, UNSERIALIZABLE_TYPES):
57
57
  return False
58
58
 
59
59
  # use id() to handle un-hashable objects
60
- if id(obj) in _recursive_guard:
60
+ if id(obj) in _seen:
61
61
  return True
62
62
 
63
63
  if isinstance(obj, dict):
64
- guard = _recursive_guard | {id(obj)}
65
- for key, value in obj.items():
66
- if (
67
- not is_serializable(key, _recursive_guard=guard)
68
- or not is_serializable(value, _recursive_guard=guard)
69
- ):
70
- return False
64
+ seen = _seen | {id(obj)}
65
+ return all(
66
+ is_serializable(key, _seen=seen) and is_serializable(value, _seen=seen)
67
+ for key, value in obj.items()
68
+ )
71
69
  elif isinstance(obj, (list, tuple, set, frozenset)):
72
- guard = _recursive_guard | {id(obj)}
73
- return all(is_serializable(item, _recursive_guard=guard) for item in obj)
70
+ seen = _seen | {id(obj)}
71
+ return all(is_serializable(item, _seen=seen) for item in obj)
74
72
 
75
73
  # if an issue occurs for a non-serializable type, pickle will complain
76
- # since the object is likely coming from a third-party extension (we
77
- # natively expect 'simple' types and not weird ones)
74
+ # since the object is likely coming from a third-party extension
75
+ # (we natively expect 'simple' types and not weird ones)
78
76
  return True
79
77
 
80
78
 
@@ -473,7 +471,8 @@ class Config:
473
471
  # will always mark the config value as changed,
474
472
  # and thus always invalidate the cache and perform a rebuild.
475
473
  logger.warning(
476
- __('cannot cache unpickable configuration value: %r'),
474
+ __('cannot cache unpickable configuration value: %r '
475
+ '(because it contains a function, class, or module object)'),
477
476
  name,
478
477
  type='config',
479
478
  subtype='cache',
@@ -44,6 +44,59 @@ if TYPE_CHECKING:
44
44
  from sphinx.environment import BuildEnvironment
45
45
  from sphinx.util.typing import ExtensionMetadata, OptionSpec
46
46
 
47
+ # re-export objects for backwards compatibility
48
+ # xref https://github.com/sphinx-doc/sphinx/issues/12295
49
+ from sphinx.domains.c._ast import ( # NoQA: F401
50
+ ASTAlignofExpr,
51
+ ASTArray,
52
+ ASTAssignmentExpr,
53
+ ASTBase,
54
+ ASTBinOpExpr,
55
+ ASTBooleanLiteral,
56
+ ASTBracedInitList,
57
+ ASTCastExpr,
58
+ ASTCharLiteral,
59
+ ASTDeclarator,
60
+ ASTDeclaratorNameBitField,
61
+ ASTDeclaratorNameParam,
62
+ ASTDeclaratorParen,
63
+ ASTDeclaratorPtr,
64
+ ASTDeclSpecs,
65
+ ASTDeclSpecsSimple,
66
+ ASTEnum,
67
+ ASTEnumerator,
68
+ ASTExpression,
69
+ ASTFallbackExpr,
70
+ ASTFunctionParameter,
71
+ ASTIdExpression,
72
+ ASTInitializer,
73
+ ASTLiteral,
74
+ ASTMacro,
75
+ ASTMacroParameter,
76
+ ASTNumberLiteral,
77
+ ASTParameters,
78
+ ASTParenExpr,
79
+ ASTParenExprList,
80
+ ASTPostfixArray,
81
+ ASTPostfixCallExpr,
82
+ ASTPostfixDec,
83
+ ASTPostfixExpr,
84
+ ASTPostfixInc,
85
+ ASTPostfixMemberOfPointer,
86
+ ASTPostfixOp,
87
+ ASTSizeofExpr,
88
+ ASTSizeofType,
89
+ ASTStringLiteral,
90
+ ASTStruct,
91
+ ASTTrailingTypeSpec,
92
+ ASTTrailingTypeSpecFundamental,
93
+ ASTTrailingTypeSpecName,
94
+ ASTType,
95
+ ASTTypeWithInit,
96
+ ASTUnaryOpExpr,
97
+ ASTUnion,
98
+ )
99
+
47
100
  logger = logging.getLogger(__name__)
48
101
 
49
102
 
@@ -48,6 +48,98 @@ if TYPE_CHECKING:
48
48
  from sphinx.environment import BuildEnvironment
49
49
  from sphinx.util.typing import ExtensionMetadata, OptionSpec
50
50
 
51
+ # re-export objects for backwards compatibility
52
+ # xref https://github.com/sphinx-doc/sphinx/issues/12295
53
+ from sphinx.domains.cpp._ast import ( # NoQA: F401
54
+ ASTAlignofExpr,
55
+ ASTArray,
56
+ ASTAssignmentExpr,
57
+ ASTBase,
58
+ ASTBaseClass,
59
+ ASTBinOpExpr,
60
+ ASTBooleanLiteral,
61
+ ASTBracedInitList,
62
+ ASTCastExpr,
63
+ ASTCharLiteral,
64
+ ASTClass,
65
+ ASTCommaExpr,
66
+ ASTConcept,
67
+ ASTConditionalExpr,
68
+ ASTDeclarator,
69
+ ASTDeclaratorMemPtr,
70
+ ASTDeclaratorNameBitField,
71
+ ASTDeclaratorNameParamQual,
72
+ ASTDeclaratorParamPack,
73
+ ASTDeclaratorParen,
74
+ ASTDeclaratorPtr,
75
+ ASTDeclaratorRef,
76
+ ASTDeclSpecs,
77
+ ASTDeclSpecsSimple,
78
+ ASTDeleteExpr,
79
+ ASTEnum,
80
+ ASTEnumerator,
81
+ ASTExplicitCast,
82
+ ASTExplicitSpec,
83
+ ASTExpression,
84
+ ASTFallbackExpr,
85
+ ASTFoldExpr,
86
+ ASTFunctionParameter,
87
+ ASTIdExpression,
88
+ ASTInitializer,
89
+ ASTLiteral,
90
+ ASTNewExpr,
91
+ ASTNoexceptExpr,
92
+ ASTNoexceptSpec,
93
+ ASTNumberLiteral,
94
+ ASTOperator,
95
+ ASTOperatorBuildIn,
96
+ ASTOperatorLiteral,
97
+ ASTOperatorType,
98
+ ASTPackExpansionExpr,
99
+ ASTParametersQualifiers,
100
+ ASTParenExpr,
101
+ ASTParenExprList,
102
+ ASTPointerLiteral,
103
+ ASTPostfixArray,
104
+ ASTPostfixCallExpr,
105
+ ASTPostfixDec,
106
+ ASTPostfixExpr,
107
+ ASTPostfixInc,
108
+ ASTPostfixMember,
109
+ ASTPostfixMemberOfPointer,
110
+ ASTPostfixOp,
111
+ ASTRequiresClause,
112
+ ASTSizeofExpr,
113
+ ASTSizeofParamPack,
114
+ ASTSizeofType,
115
+ ASTStringLiteral,
116
+ ASTTemplateArgConstant,
117
+ ASTTemplateArgs,
118
+ ASTTemplateDeclarationPrefix,
119
+ ASTTemplateIntroduction,
120
+ ASTTemplateIntroductionParameter,
121
+ ASTTemplateKeyParamPackIdDefault,
122
+ ASTTemplateParam,
123
+ ASTTemplateParamConstrainedTypeWithInit,
124
+ ASTTemplateParamNonType,
125
+ ASTTemplateParams,
126
+ ASTTemplateParamTemplateType,
127
+ ASTTemplateParamType,
128
+ ASTThisLiteral,
129
+ ASTTrailingTypeSpec,
130
+ ASTTrailingTypeSpecDecltype,
131
+ ASTTrailingTypeSpecDecltypeAuto,
132
+ ASTTrailingTypeSpecFundamental,
133
+ ASTTrailingTypeSpecName,
134
+ ASTType,
135
+ ASTTypeId,
136
+ ASTTypeUsing,
137
+ ASTTypeWithInit,
138
+ ASTUnaryOpExpr,
139
+ ASTUnion,
140
+ ASTUserDefinedLiteral,
141
+ )
142
+
51
143
  logger = logging.getLogger(__name__)
52
144
 
53
145
 
@@ -38,6 +38,10 @@ if TYPE_CHECKING:
38
38
 
39
39
  # re-export objects for backwards compatibility
40
40
  # xref https://github.com/sphinx-doc/sphinx/issues/12295
41
+ from sphinx.domains.python._annotations import ( # NoQA: F401
42
+ _parse_arglist, # for sphinx-immaterial
43
+ type_to_xref,
44
+ )
41
45
  from sphinx.domains.python._object import ( # NoQA: F401
42
46
  PyField,
43
47
  PyGroupedField,
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.5
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,8 +1,8 @@
1
- sphinx/__init__.py,sha256=xwB-1xnP8xOaVq3e22IK3dZVTFoHaiQIRPMHjH8pevM,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
5
- sphinx/config.py,sha256=g7XAMEnrqq66hwPbzSxnooyeJl_UrEagFQ0SPxnXEtw,30085
5
+ sphinx/config.py,sha256=qOPk7Mt41Wins29EO2Xb_X91gL4cxIRBCU-O0i00Gzw,30039
6
6
  sphinx/deprecation.py,sha256=ABIo1t4mSwCTT2uxpUKNcwQHb3X6qur_tziCWzIhqtE,2437
7
7
  sphinx/errors.py,sha256=mFyE7P1fmnVTeYtpP3wv8oXrKyTw1H0WcE46VypUPd0,3412
8
8
  sphinx/events.py,sha256=3GE0v6gIu81Llbed-6zBPDy9G1a-tY9Z1ujUIGBBN5M,4351
@@ -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
@@ -55,17 +55,17 @@ sphinx/domains/index.py,sha256=3eHbatgPlpfeEbJtqQ6HfBQlEFSem9rYG8fdMUExypU,4266
55
55
  sphinx/domains/javascript.py,sha256=vGuLe4mtbVzwXyWfHuDQIyFpACKo_2TXTFUaUCw6ebU,19444
56
56
  sphinx/domains/math.py,sha256=56YFKQ0o5o2ep9EZ8IobFIsgHpKrOYonSsqjGs_b6EE,5655
57
57
  sphinx/domains/rst.py,sha256=8nsCjM2GNScWq56u0MC1GaZxlSWBUfXLl_qCYVYdVFU,10696
58
- sphinx/domains/c/__init__.py,sha256=kJKWgiC_6tb-Ueomooj4Up78k_ez7MtVxpqBhFt-E30,31467
58
+ sphinx/domains/c/__init__.py,sha256=SmpOFHMVw65CN3jDuS7WLOoNe0wKsazM6P_4hEqlZAg,32620
59
59
  sphinx/domains/c/_ast.py,sha256=C7UD3KNf-LZjOPzZ04zfdbm5G0wy-4wGIpLPPdZnSuY,52724
60
60
  sphinx/domains/c/_ids.py,sha256=R_6xOt4CSGmDxkXwJ5MElKhLLjkZSJdZdvwIr0VvEoM,2220
61
61
  sphinx/domains/c/_parser.py,sha256=1jTwk2nHwZqDq5PCd2bxhmA8ElO9WBwHGCniaynH4Zs,41261
62
62
  sphinx/domains/c/_symbol.py,sha256=dmmsF1tNcDGw_rOMRywjqc3DkKxWWFvKRr4Eel15j5A,28256
63
- sphinx/domains/cpp/__init__.py,sha256=hlNSpvBCtW2DR98vFq8cRs86X5U1LQmy_hdHzOupY8U,45018
63
+ sphinx/domains/cpp/__init__.py,sha256=y9QfCqlleF9Q5K_HSzafjgzqUSsX-EEpX0IxgGJHkdo,47157
64
64
  sphinx/domains/cpp/_ast.py,sha256=P2yAf7gCCtUSZrMdDn6m9dd6-MhhAcvRFQtDGwqO23w,137953
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=j51-9Pm7H0lrzQP9fO81rOpIce2A2VUdjv49kgju-iQ,33958
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.5.dist-info/entry_points.txt,sha256=KU_c9jqXj7yyZylSz11XRIXG3gAZApQa0d5DmcfyA7M,188
578
- sphinx-7.3.5.dist-info/LICENSE.rst,sha256=HdZPUFcmQaLySBc9fKvRC5aOUNkxL9Gz5py0p6XGDk4,3135
579
- sphinx-7.3.5.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
580
- sphinx-7.3.5.dist-info/METADATA,sha256=Rf0VlooekrRJUqECzZzuf5EDmzbNI7KQQfiLXmhGr3U,6021
581
- sphinx-7.3.5.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