Commit Graph

153 Commits

Author SHA1 Message Date
Adam Turner
3d0110a95a Enable test_cython on Python 3.12 2023-09-13 03:07:19 +01:00
Matt Wozniski
8248be31db
autodoc: Reset `sys.modules` on partial import failure (#11645)
If importing with ``TYPE_CHECKING is True`` fails, reset the state of ``sys.modules``
so that the attempt with ``TYPE_CHECKING is False`` may succeed.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-08-29 20:05:41 +01:00
picnixz
2656f34848
Fix rendering of `Literal` annotations with enum values (#11517)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-08-14 23:33:57 +01:00
Riccardo Mori
137b3adce1
Make stringify_annotation recursive on builtins with args (#11570)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-08-14 19:28:12 +01:00
Adam Turner
629b862cde
Spring-clean `sphinx.testing.utils` (#11534) 2023-07-28 23:24:13 +01:00
Adam Turner
1cfb68d8be
Consistently name the object description options (#11533)
*  The directive option ``:noindex:`` was renamed to ``:no-index:``.
*  The directive option ``:noindexentry:`` was renamed to ``:no-index-entry:``.
*  The directive option ``:nocontentsentry:`` was renamed to ``:no-contents-entry:``.

The previous names are retained as aliases, but will be deprecated
and removed in a future version of Sphinx (9.0 or later).
2023-07-28 22:30:26 +01:00
Martin Liška
2c0b81d88b
Refactor `test_attrgetter_using` (#11293)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-28 04:20:36 +01:00
Adam Turner
ad61e41157
Drop support for Python 3.8 (#11511) 2023-07-25 02:07:23 +01:00
picnixz
aba392d87f
Support type comments in `PropertyDocumenter` (#11298) 2023-04-06 22:56:17 +01:00
Adam Turner
43e681e88f Remove `.egg support from pycode ModuleAnalyser`
Python eggs are a now-obsolete binary distribution format.
2023-03-05 19:03:06 +00:00
Adam Turner
4804390604 Resolve `flake8-return` errors 2023-02-18 02:16:50 +00:00
Adam Turner
6c56988979 Unescape quotation marks where possible 2023-02-18 02:16:50 +00:00
Adam Turner
c8f4a03dac Fix COM812 2023-02-18 01:58:05 +00:00
Adam Turner
29e12ec4db
Document `typing.NewType` as a class (#10700) 2023-01-02 18:57:04 +00:00
Adam Turner
77a02cf696
Use PEP 604 display for `typing.Optional and typing.Union` (#11072) 2023-01-02 17:49:18 +00:00
Adam Turner
f4c8a0a68e Insert `from __future__ import annotations` 2023-01-01 20:48:37 +00:00
Adam Turner
aeda313430 Reflect changes to `Enum` signature in Python 3.12 2022-12-30 18:11:52 +00:00
Daniel Eades
1abb24e309 remove blanket 'noqas' 2022-12-16 16:50:24 +01:00
Adam Turner
4660b62de0 Drop Python 3.7 2022-09-27 18:31:47 +01:00
Adam Turner
7649eb1505 Clean up after dropping Python 3.6 2022-09-27 18:31:47 +01:00
Adam Turner
14c9b40f15 Merge branch '5.x'
# Conflicts:
#	setup.py
#	sphinx/application.py
#	sphinx/environment/__init__.py
#	sphinx/ext/autodoc/directive.py
#	tests/test_build_html.py
2022-09-09 09:58:24 +01:00
danieleades
12bff8a273
Remove unneeded noqa lint suppression comments (#10772) 2022-08-28 20:03:17 +01:00
danieleades
2b02173617
Further improve type annotations, reduce mypy whitelist (#10770)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2022-08-28 19:50:01 +01:00
Takeshi KOMIYA
7e68154e49
Drop python 3.6 support (#10468) 2022-06-16 19:33:55 +01:00
Takeshi KOMIYA
29edce9243 test: Add testcase for autodoc_inherit_docstring and attributes (refs: #10539) 2022-06-14 02:49:07 +09:00
Hugo van Kemenade
184fe83c73 Remove redundant code for Python < 3.6 2022-05-01 17:50:34 +03:00
Takeshi KOMIYA
3d2c54eb47 Fix a testcase for py36 2022-04-05 01:08:58 +09:00
James Parkhurst
88b213bbf0 Added test case 2022-04-04 11:45:58 +01:00
Takeshi KOMIYA
aa1bc83c2a Merge branch '4.x' 2022-03-19 22:58:15 +09:00
Adam Turner
6bb7b891a1 Remove copyright and licence fields 2022-02-20 03:06:23 +00:00
Adam Turner
b691ebcc3e Conform to PEP 257 summary line conventions 2022-02-20 02:57:02 +00:00
Adam Turner
5694e0ce60 Fix module docstring indentation 2022-02-20 00:35:13 +00:00
Adam Turner
4f5a3269a6 Fix module docstring first line 2022-02-20 00:11:08 +00:00
Adam Turner
6b8bccec59 Remove module titles in docstrings 2022-02-19 23:17:29 +00:00
Takeshi KOMIYA
616f112e6a autodoc: The default of autodoc_typehints_format becomes to 'smart'
The default value of autodoc_typehints_format configuration is changed
to `'smart'`.  It will suppress the leading module names of typehints
(ex. `io.StringIO` -> `StringIO`).

refs: #9075
2022-01-02 17:35:19 +09:00
Takeshi KOMIYA
e1c090d9f7
Merge pull request #10034 from tk0miya/10027_autodoc_typehints_format_for_bases
Fix #10027: autodoc_typehints_format does not work with :show-inheritance:
2022-01-02 11:39:22 +09:00
Takeshi KOMIYA
b84771dcd2 A happy new year! 2022-01-01 18:45:03 +09:00
Takeshi KOMIYA
3fc98a2b3d Fix #10027: autodoc_typehints_format does not work with :show-inheritance: 2022-01-01 18:06:57 +09:00
Takeshi KOMIYA
fb92547b91 Fix #9866: autodoc: doccoment for the imported class was ignored
Autodoc tried to scan doccomment on the module where the class defined.
But it failed to get it if the class is imported from other module.

This analyzes the target module to obtain the doccomment.
2021-11-21 18:50:54 +09:00
Takeshi KOMIYA
b778ee806e Fix #9752: autodoc: Failed to detect type annotation for slots attribute 2021-10-23 14:59:36 +09:00
Takeshi KOMIYA
2760b3bb79 test: Support python-3.11 2021-10-09 14:41:39 +09:00
Takeshi KOMIYA
506590d4ba
Merge pull request #9640 from tk0miya/9639_support_asyncgenfunction
Close #9639: autodoc: Support asynchronous generator functions
2021-09-18 01:03:34 +09:00
Takeshi KOMIYA
ccfca458ea Close #9639: autodoc: Support asynchronous generator functions 2021-09-17 02:20:40 +09:00
Takeshi KOMIYA
ed227d7d3c Fix #9630: autodoc: Failed to build xrefs if primary_domain is not 'py'
Autodoc generates reST code that uses raw `:obj:` and `:class:` xrefs to
refer the classes and types.  But they're fragile because they assume
the primary_domain=='py'.

This adds `:py:` prefix to these xrefs to make them robust.
2021-09-14 23:59:47 +09:00
Takeshi KOMIYA
65c089bd40 Fix #9487: autodoc: typehint for cached_property is not shown 2021-07-22 23:25:03 +09:00
Karolina Surma
42d9d11247 Fix testcase: Enum changes were reverted in Python 3.10 2021-07-14 08:40:03 +02:00
Takeshi KOMIYA
30efa3d947
Merge branch '4.x' into 8597_metadata_only_docstring 2021-05-03 22:11:10 +09:00
Takeshi KOMIYA
caa6579dbd Fix #8872: autodoc: stacked singledispatches are wrongly rendered
When multiple singledispatch decorators are stacked, the first typehints
are copied to the subsequent definitions unexpectedly.

Now autodoc generates a dummy function not to affect typehints to
subsequent functions.
2021-05-03 21:51:19 +09:00
Takeshi KOMIYA
469def56b6 Fix #8597: autodoc: metadata only docstring is treated as undocumented
The metadata in docstring is invisible content. Therefore docstring
having only metadata should be treated as undocumented.
2021-05-02 23:17:58 +09:00
Takeshi KOMIYA
58ec5c4089 Fix #9110: autodoc: metadata of GenericAlias is not rendered as a reference in py37+
GenericAliasMixin should use `restify()` to render the metadata of
GenericAlias as py36 does.
2021-04-19 01:11:08 +09:00