Commit Graph

127 Commits

Author SHA1 Message Date
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
Takeshi KOMIYA
c2c2b81f91 Fix #8818: autodoc: Super class having `Any` arguments causes nit-picky warning
On generating the base class information, unexpected nit-picky warning
for ``typing.Any`` was emitted.  This fixes it by using `~` prefix on
generating a cross-reference to make it valid.
2021-04-18 00:25:48 +09:00
Takeshi KOMIYA
bdbabb14c2 Merge branch '3.x' 2021-04-03 13:22:21 +09:00
Takeshi KOMIYA
ec4d410c48 Fix testcase: the signature of Enum class has been changed since HEAD of 3.10 2021-04-03 13:08:31 +09:00
Takeshi KOMIYA
acf66bc4d5 Close #5603: autodoc: Allow to refer to a python object using canonical name
This generates `:canonical:` option for `:py:class:` directive if the
target class is imported from other module.  It allows users to refer it
using both the new name (imported name) and the original name (canonical
name).

It helps a library that implements some class in private module (like
`_io.StringIO`), and publish it as public module (like `io.StringIO`).
2021-03-27 17:34:15 +09:00
Takeshi KOMIYA
cb654d287b Rename DocumenterBridge.filename_set to record_dependencies
DocumenterBridge.filename_set has been used since its beginning.  On the
other hand, in docutils, record_dependencies attribute is well-used to
store the list of dependency files.  So this renames it to docutils'
standard attribute.
2021-03-21 00:52:53 +09:00
Takeshi KOMIYA
75f5122996 Fix #7383: autodoc: Support typehints for properties
py:property directive now outputs py:property directive to describe
its type annotation.
2021-03-13 22:51:46 +09:00
Takeshi KOMIYA
a39cf57717 Close #8924: autodoc: Support bound argument for TypeVar 2021-02-24 22:51:06 +09:00
jfbu
87fa272763 Merge branch '3.x' into merge_3.x_into_master
Resolved Conflicts:
	sphinx/texinputs/sphinxpackagefootnote.sty
2021-02-04 16:31:45 +01:00
Takeshi KOMIYA
0d50b97fa3
Merge pull request #8297 from pbudzyns/exclude-members-fix
Local autodoc options override or extend autodoc_default_options.
2021-02-04 22:24:52 +09:00
jfbu
fbafb308b8 Merge branch '3.x' into master_with_merged_3.x 2021-02-02 18:01:55 +01:00
Takeshi KOMIYA
7ca5248057 Fix #8775: Avoid the crash of autodoc caused by type union operator
The type union operator (PEP-604) causes autodoc crashed in python 3.9
or below because of the syntax is not suppoerted yet in the interpreters.
Internally, `typing.get_type_hints()` raises TypeError on evaluating the
annotation by BitOr operator for types.

To avoid the crash, this adds a fallback not to evaluate the annotations
and keep as is.  As a side effect, `autodoc_type_aliases` will not work
for the modules and classes that uses type union operator for their
annotations.
2021-02-01 21:21:56 +09:00
pbudzyns
fd6587d5e9 rebase and fix tests 2021-02-01 10:58:09 +01:00
pbudzyns
270921d73a Merge remote-tracking branch 'upstream/3.x' into exclude-members-fix 2021-02-01 10:46:44 +01:00
pbudzyns
8d380cadc7 check if autodoc_defaults are str, fix tests 2021-02-01 09:46:19 +01:00
Takeshi KOMIYA
7318d1dfd4 autodoc: Support type union operator (PEP-604) (refs: #8775)
Upgrade autodoc to support type union operator introduced in
PEP-604. It's available only with python 3.10+.
2021-01-31 23:38:36 +09:00
pbudzyns
ac5079ed85 redundant '+' has no effect 2021-01-25 16:07:18 +01:00
pbudzyns
381e30c23b add more extendable options and tests 2021-01-25 13:24:01 +01:00
pbudzyns
7348ba8d60 add more extendable options and tests 2021-01-25 13:15:13 +01:00
pbudzyns
0a85b4148e add more extendable options and tests 2021-01-25 12:54:08 +01:00
Takeshi KOMIYA
5ce72f465b Merge branch '3.x' 2021-01-22 22:52:32 +09:00
Takeshi KOMIYA
d88166e84b Close #8514: autodoc: Default values of overloads are taken from actual implementation
As a well-known idiom, mypy recommends to use ellipsis ("...") for
default argument values as a elided style.  This allows to write the
style and helps to document it with copying the default argument
values from actual implementation.

Note: This does not copy the default argument value when the argument
of overloaded function has its own default value.
2021-01-17 02:32:50 +09:00
Takeshi KOMIYA
425cd1af02 Fix #8693: autodoc: Default values for overloads are rendered as string
The default values for overloaded functions are rendered as string
literal unexpectedly because autodoc extracts code snippets from
the source code, not actual value (ex. int, ellipsis, and so on).

This introduces a simple wrapper class; `DefaultValue` to render these
code snippets like actual values, not string literals.
2021-01-17 02:30:20 +09:00
Takeshi KOMIYA
4b452338f9 Merge branch '3.x' 2021-01-01 13:57:19 +09:00
Takeshi KOMIYA
7ecf6b88aa Merge branch '3.4.x' into 3.x 2021-01-01 13:56:19 +09:00
Takeshi KOMIYA
f996859420 A happy new year!
.. note::

   $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \;
   $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
2021-01-01 13:40:48 +09:00
Takeshi KOMIYA
a122397b4b Merge branch '3.x' 2020-12-29 18:37:45 +09:00