sphinx-autoapi 3.3.1__tar.gz → 3.3.2__tar.gz

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.
Files changed (131) hide show
  1. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/CHANGELOG.rst +9 -0
  2. {sphinx_autoapi-3.3.1/sphinx_autoapi.egg-info → sphinx_autoapi-3.3.2}/PKG-INFO +1 -1
  3. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/__init__.py +2 -2
  4. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/documenters.py +23 -12
  5. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2/sphinx_autoapi.egg-info}/PKG-INFO +1 -1
  6. {sphinx_autoapi-3.3.1/tests/python/pymovedconfpy → sphinx_autoapi-3.3.2/tests/python/pyexample}/example/example.py +24 -0
  7. {sphinx_autoapi-3.3.1/tests/python/pyexample → sphinx_autoapi-3.3.2/tests/python/pymovedconfpy}/example/example.py +24 -0
  8. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/test_pyintegration.py +68 -0
  9. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/LICENSE.rst +0 -0
  10. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/MANIFEST.in +0 -0
  11. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/README.rst +0 -0
  12. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/_astroid_utils.py +0 -0
  13. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/_mapper.py +0 -0
  14. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/_objects.py +0 -0
  15. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/_parser.py +0 -0
  16. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/directives.py +0 -0
  17. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/extension.py +0 -0
  18. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/inheritance_diagrams.py +0 -0
  19. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/settings.py +0 -0
  20. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/index.rst +0 -0
  21. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/attribute.rst +0 -0
  22. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/class.rst +0 -0
  23. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/data.rst +0 -0
  24. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/exception.rst +0 -0
  25. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/function.rst +0 -0
  26. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/method.rst +0 -0
  27. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/module.rst +0 -0
  28. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/package.rst +0 -0
  29. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/autoapi/templates/python/property.rst +0 -0
  30. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/pyproject.toml +0 -0
  31. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/setup.cfg +0 -0
  32. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/setup.py +0 -0
  33. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/sphinx_autoapi.egg-info/SOURCES.txt +0 -0
  34. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/sphinx_autoapi.egg-info/dependency_links.txt +0 -0
  35. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/sphinx_autoapi.egg-info/requires.txt +0 -0
  36. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/sphinx_autoapi.egg-info/top_level.txt +0 -0
  37. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/conftest.py +0 -0
  38. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pep695/conf.py +0 -0
  39. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pep695/example/example.py +0 -0
  40. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pep695/index.rst +0 -0
  41. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py310unionpipe/conf.py +0 -0
  42. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py310unionpipe/example/example.py +0 -0
  43. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py310unionpipe/index.rst +0 -0
  44. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py38positionalparams/conf.py +0 -0
  45. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py38positionalparams/example/example.py +0 -0
  46. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py38positionalparams/index.rst +0 -0
  47. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3example/conf.py +0 -0
  48. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3example/example/example.py +0 -0
  49. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3example/example/example2.py +0 -0
  50. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3example/index.rst +0 -0
  51. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3implicitnamespace/conf.py +0 -0
  52. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3implicitnamespace/index.rst +0 -0
  53. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3implicitnamespace/namespace/example/__init__.py +0 -0
  54. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3implicitnamespace/namespace/sibling/__init__.py +0 -0
  55. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/py3implicitnamespace/namespace/sibling/sub_sibling.py +0 -0
  56. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyannotationcommentsexample/conf.py +0 -0
  57. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyannotationcommentsexample/example/example.py +0 -0
  58. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyannotationcommentsexample/index.rst +0 -0
  59. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyautodoc_typehints/conf.py +0 -0
  60. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyautodoc_typehints/example/example.py +0 -0
  61. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyautodoc_typehints/example/example2.py +0 -0
  62. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyautodoc_typehints/index.rst +0 -0
  63. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyemptyexample/conf.py +0 -0
  64. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyemptyexample/index.rst +0 -0
  65. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyexample/conf.py +0 -0
  66. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyexample/index.rst +0 -0
  67. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyexample/manualapi.rst +0 -0
  68. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyexample/null.rst +0 -0
  69. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample/conf.py +0 -0
  70. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample/example/example.py +0 -0
  71. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample/example/example.pyi +0 -0
  72. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample/index.rst +0 -0
  73. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample2/conf.py +0 -0
  74. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample2/example/example.py +0 -0
  75. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample2/example/example.pyi +0 -0
  76. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyiexample2/index.rst +0 -0
  77. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyisubmoduleinit/conf.py +0 -0
  78. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyisubmoduleinit/example/example.py +0 -0
  79. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyisubmoduleinit/example/submodule_foo/__init__.pyi +0 -0
  80. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyisubmoduleinit/index.rst +0 -0
  81. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pymovedconfpy/confpy/conf.py +0 -0
  82. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pymovedconfpy/index.rst +0 -0
  83. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pymovedconfpy/manualapi.rst +0 -0
  84. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pynorender/conf.py +0 -0
  85. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pynorender/example/_example.py +0 -0
  86. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pynorender/index.rst +0 -0
  87. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/__init__.py +0 -0
  88. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/_private_module.py +0 -0
  89. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/binary_data.py +0 -0
  90. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/foo.py +0 -0
  91. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/submodule.py +0 -0
  92. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/subpackage/__init__.py +0 -0
  93. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/subpackage/submodule.py +0 -0
  94. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/unicode_data.py +0 -0
  95. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/wildall/__init__.py +0 -0
  96. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/wildall/simple/__init__.py +0 -0
  97. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/wildcard/__init__.py +0 -0
  98. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/wildchain/__init__.py +0 -0
  99. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/complex/wildwildchain/__init__.py +0 -0
  100. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/conf.py +0 -0
  101. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackagecomplex/index.rst +0 -0
  102. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/conf.py +0 -0
  103. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/index.rst +0 -0
  104. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/__init__.py +0 -0
  105. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/_private_submodule.py +0 -0
  106. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/_private_subpackage/__init__.py +0 -0
  107. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/_private_subpackage/submodule.py +0 -0
  108. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/_private_subpackage/subpackage/__init__.py +0 -0
  109. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/_private_subpackage/subpackage/submodule.py +0 -0
  110. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/submodule.py +0 -0
  111. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/subpackage/__init__.py +0 -0
  112. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pypackageexample/package/subpackage/submodule.py +0 -0
  113. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyskipexample/conf.py +0 -0
  114. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyskipexample/example/example.py +0 -0
  115. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pyskipexample/index.rst +0 -0
  116. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pystdlib/conf.py +0 -0
  117. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pystdlib/index.rst +0 -0
  118. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pystdlib/stdlib/json.py +0 -0
  119. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pystdlib/stdlib/myast.py +0 -0
  120. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/pystdlib/stdlib/myjson.py +0 -0
  121. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/test_own_page_option.py +0 -0
  122. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/python/test_parser.py +0 -0
  123. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/templateexample/conf.py +0 -0
  124. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/templateexample/example/example.py +0 -0
  125. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/templateexample/index.rst +0 -0
  126. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/templateexample/template_overrides/python/function.rst +0 -0
  127. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/test_astroid_utils.py +0 -0
  128. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/test_integration.py +0 -0
  129. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/toctreeexample/conf.py +0 -0
  130. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/toctreeexample/example/example.py +0 -0
  131. {sphinx_autoapi-3.3.1 → sphinx_autoapi-3.3.2}/tests/toctreeexample/index.rst +0 -0
@@ -5,6 +5,15 @@ Versions follow `Semantic Versioning <https://semver.org/>`_ (``<major>.<minor>.
5
5
 
6
6
  .. towncrier release notes start
7
7
 
8
+ v3.3.2 (2024-09-25)
9
+ -------------------
10
+
11
+ Bugfixes
12
+ ^^^^^^^^
13
+
14
+ - Fix types missing from documentation generated by autodoc-style directives. (#473)
15
+
16
+
8
17
  v3.3.1 (2024-09-01)
9
18
  -------------------
10
19
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sphinx-autoapi
3
- Version: 3.3.1
3
+ Version: 3.3.2
4
4
  Summary: Sphinx API documentation generator
5
5
  Home-page: http://github.com/readthedocs/sphinx-autoapi
6
6
  Author: Eric Holscher
@@ -3,5 +3,5 @@
3
3
  from .extension import setup
4
4
 
5
5
  __all__ = ("setup",)
6
- __version__ = "3.3.1"
7
- __version_info__ = (3, 3, 1)
6
+ __version__ = "3.3.2"
7
+ __version_info__ = (3, 3, 2)
@@ -98,7 +98,7 @@ class _AutoapiDocstringSignatureMixin:
98
98
 
99
99
 
100
100
  class AutoapiFunctionDocumenter(
101
- AutoapiDocumenter, autodoc.FunctionDocumenter, _AutoapiDocstringSignatureMixin
101
+ AutoapiDocumenter, _AutoapiDocstringSignatureMixin, autodoc.FunctionDocumenter
102
102
  ):
103
103
  objtype = "apifunction"
104
104
  directivetype = "function"
@@ -147,9 +147,7 @@ class AutoapiDecoratorDocumenter(
147
147
  return "(" + to_format + ")"
148
148
 
149
149
 
150
- class AutoapiClassDocumenter(
151
- AutoapiDocumenter, autodoc.ClassDocumenter, _AutoapiDocstringSignatureMixin
152
- ):
150
+ class AutoapiClassDocumenter(AutoapiDocumenter, autodoc.ClassDocumenter):
153
151
  objtype = "apiclass"
154
152
  directivetype = "class"
155
153
  doc_as_attr = False
@@ -174,9 +172,18 @@ class AutoapiClassDocumenter(
174
172
  bases = ", ".join(f":class:`{base}`" for base in self.object.bases)
175
173
  self.add_line(f" Bases: {bases}", sourcename)
176
174
 
175
+ def format_signature(self, **kwargs):
176
+ # Set "manual" attributes at the last possible moment.
177
+ # This is to let a manual entry or docstring searching happen first,
178
+ # and falling back to the discovered signature only when necessary.
179
+ if self.args is None:
180
+ self.args = self.object.args
181
+
182
+ return super().format_signature(**kwargs)
183
+
177
184
 
178
185
  class AutoapiMethodDocumenter(
179
- AutoapiDocumenter, autodoc.MethodDocumenter, _AutoapiDocstringSignatureMixin
186
+ AutoapiDocumenter, _AutoapiDocstringSignatureMixin, autodoc.MethodDocumenter
180
187
  ):
181
188
  objtype = "apimethod"
182
189
  directivetype = "method"
@@ -230,9 +237,6 @@ class AutoapiPropertyDocumenter(AutoapiDocumenter, autodoc.PropertyDocumenter):
230
237
  autodoc.ClassLevelDocumenter.add_directive_header(self, sig)
231
238
 
232
239
  sourcename = self.get_sourcename()
233
- if self.options.annotation and self.options.annotation is not autodoc.SUPPRESS:
234
- self.add_line(f" :type: {self.options.annotation}", sourcename)
235
-
236
240
  for property_type in (
237
241
  "abstractmethod",
238
242
  "classmethod",
@@ -240,6 +244,9 @@ class AutoapiPropertyDocumenter(AutoapiDocumenter, autodoc.PropertyDocumenter):
240
244
  if property_type in self.object.properties:
241
245
  self.add_line(f" :{property_type}:", sourcename)
242
246
 
247
+ if self.object.annotation:
248
+ self.add_line(f" :type: {self.object.annotation}", sourcename)
249
+
243
250
 
244
251
  class AutoapiDataDocumenter(AutoapiDocumenter, autodoc.DataDocumenter):
245
252
  objtype = "apidata"
@@ -254,14 +261,16 @@ class AutoapiDataDocumenter(AutoapiDocumenter, autodoc.DataDocumenter):
254
261
  autodoc.ModuleLevelDocumenter.add_directive_header(self, sig)
255
262
  sourcename = self.get_sourcename()
256
263
  if not self.options.annotation:
257
- # TODO: Change sphinx to allow overriding of object description
258
264
  if self.object.value is not None:
259
- self.add_line(f" :annotation: = {self.object.value}", sourcename)
265
+ self.add_line(f" :value: {self.object.value}", sourcename)
260
266
  elif self.options.annotation is autodoc.SUPPRESS:
261
267
  pass
262
268
  else:
263
269
  self.add_line(f" :annotation: {self.options.annotation}", sourcename)
264
270
 
271
+ if self.object.annotation:
272
+ self.add_line(f" :type: {self.object.annotation}", sourcename)
273
+
265
274
 
266
275
  class AutoapiAttributeDocumenter(AutoapiDocumenter, autodoc.AttributeDocumenter):
267
276
  objtype = "apiattribute"
@@ -277,14 +286,16 @@ class AutoapiAttributeDocumenter(AutoapiDocumenter, autodoc.AttributeDocumenter)
277
286
  autodoc.ClassLevelDocumenter.add_directive_header(self, sig)
278
287
  sourcename = self.get_sourcename()
279
288
  if not self.options.annotation:
280
- # TODO: Change sphinx to allow overriding of object description
281
289
  if self.object.value is not None:
282
- self.add_line(f" :annotation: = {self.object.value}", sourcename)
290
+ self.add_line(f" :value: {self.object.value}", sourcename)
283
291
  elif self.options.annotation is autodoc.SUPPRESS:
284
292
  pass
285
293
  else:
286
294
  self.add_line(f" :annotation: {self.options.annotation}", sourcename)
287
295
 
296
+ if self.object.annotation:
297
+ self.add_line(f" :type: {self.object.annotation}", sourcename)
298
+
288
299
 
289
300
  class AutoapiModuleDocumenter(AutoapiDocumenter, autodoc.ModuleDocumenter):
290
301
  objtype = "apimodule"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sphinx-autoapi
3
- Version: 3.3.1
3
+ Version: 3.3.2
4
4
  Summary: Sphinx API documentation generator
5
5
  Home-page: http://github.com/readthedocs/sphinx-autoapi
6
6
  Author: Eric Holscher
@@ -3,6 +3,7 @@
3
3
  This is a description
4
4
  """
5
5
 
6
+ from dataclasses import dataclass
6
7
  from functools import cached_property
7
8
 
8
9
  A_TUPLE = ("a", "b")
@@ -171,3 +172,26 @@ def fn_with_long_sig(
171
172
  arguments
172
173
  ):
173
174
  """A function with a long signature."""
175
+
176
+
177
+ TYPED_DATA: int = 1
178
+ """This is TYPED_DATA."""
179
+
180
+
181
+ @dataclass
182
+ class TypedAttrs:
183
+ one: str
184
+ """This is TypedAttrs.one."""
185
+ two: int = 1
186
+ """This is TypedAttrs.two."""
187
+
188
+
189
+ class TypedClassInit:
190
+ """This is TypedClassInit."""
191
+
192
+ def __init__(self, one: int = 1) -> None:
193
+ self._one = one
194
+
195
+ def typed_method(self, two: int) -> int:
196
+ """This is TypedClassInit.typed_method."""
197
+ return self._one + two
@@ -3,6 +3,7 @@
3
3
  This is a description
4
4
  """
5
5
 
6
+ from dataclasses import dataclass
6
7
  from functools import cached_property
7
8
 
8
9
  A_TUPLE = ("a", "b")
@@ -171,3 +172,26 @@ def fn_with_long_sig(
171
172
  arguments
172
173
  ):
173
174
  """A function with a long signature."""
175
+
176
+
177
+ TYPED_DATA: int = 1
178
+ """This is TYPED_DATA."""
179
+
180
+
181
+ @dataclass
182
+ class TypedAttrs:
183
+ one: str
184
+ """This is TypedAttrs.one."""
185
+ two: int = 1
186
+ """This is TypedAttrs.two."""
187
+
188
+
189
+ class TypedClassInit:
190
+ """This is TypedClassInit."""
191
+
192
+ def __init__(self, one: int = 1) -> None:
193
+ self._one = one
194
+
195
+ def typed_method(self, two: int) -> int:
196
+ """This is TypedClassInit.typed_method."""
197
+ return self._one + two
@@ -177,6 +177,74 @@ class TestSimpleModuleManual:
177
177
  example_file = parse("_build/html/manualapi.html")
178
178
  assert example_file.find(id="example.decorator_okay")
179
179
 
180
+ def test_dataclass(self, parse):
181
+ example_file = parse("_build/html/manualapi.html")
182
+
183
+ typedattrs_sig = example_file.find(id="example.TypedAttrs")
184
+ assert typedattrs_sig
185
+
186
+ typedattrs = typedattrs_sig.parent
187
+
188
+ one = typedattrs.find(id="example.TypedAttrs.one")
189
+ assert one
190
+ one_value = one.find_all(class_="property")
191
+ assert one_value[0].text == ": str"
192
+ one_docstring = one.parent.find("dd").contents[0].text
193
+ assert one_docstring.strip() == "This is TypedAttrs.one."
194
+
195
+ two = typedattrs.find(id="example.TypedAttrs.two")
196
+ assert two
197
+ two_value = two.find_all(class_="property")
198
+ assert two_value[0].text == ": int"
199
+ assert two_value[1].text == " = 1"
200
+ two_docstring = two.parent.find("dd").contents[0].text
201
+ assert two_docstring.strip() == "This is TypedAttrs.two."
202
+
203
+ def test_data(self, parse):
204
+ example_file = parse("_build/html/manualapi.html")
205
+
206
+ typed_data = example_file.find(id="example.TYPED_DATA")
207
+ assert typed_data
208
+ typed_data_value = typed_data.find_all(class_="property")
209
+ assert typed_data_value[0].text == ": int"
210
+ assert typed_data_value[1].text == " = 1"
211
+
212
+ typed_data_docstring = typed_data.parent.find("dd").contents[0].text
213
+ assert typed_data_docstring.strip() == "This is TYPED_DATA."
214
+
215
+ def test_class(self, parse):
216
+ example_file = parse("_build/html/manualapi.html")
217
+
218
+ typed_cls = example_file.find(id="example.TypedClassInit")
219
+ assert typed_cls
220
+ arg = typed_cls.find(class_="sig-param")
221
+ assert arg.text == "one: int = 1"
222
+ typed_cls_docstring = typed_cls.parent.find("dd").contents[0].text
223
+ assert typed_cls_docstring.strip() == "This is TypedClassInit."
224
+
225
+ typed_method = example_file.find(id="example.TypedClassInit.typed_method")
226
+ assert typed_method
227
+ arg = typed_method.find(class_="sig-param")
228
+ assert arg.text == "two: int"
229
+ return_type = typed_method.find(class_="sig-return-typehint")
230
+ assert return_type.text == "int"
231
+ typed_method_docstring = typed_method.parent.find("dd").contents[0].text
232
+ assert typed_method_docstring.strip() == "This is TypedClassInit.typed_method."
233
+
234
+ def test_property(self, parse):
235
+ example_file = parse("_build/html/manualapi.html")
236
+
237
+ foo_sig = example_file.find(id="example.Foo")
238
+ assert foo_sig
239
+ foo = foo_sig.parent
240
+
241
+ property_simple = foo.find(id="example.Foo.property_simple")
242
+ assert property_simple
243
+ property_simple_value = property_simple.find_all(class_="property")
244
+ assert property_simple_value[-1].text == ": int"
245
+ property_simple_docstring = property_simple.parent.find("dd").text.strip()
246
+ assert property_simple_docstring == "This property should parse okay."
247
+
180
248
 
181
249
  class TestMovedConfPy(TestSimpleModule):
182
250
  @pytest.fixture(autouse=True, scope="class")
File without changes
File without changes