summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix #9110: autodoc: metadata of GenericAlias is not rendered as a reference ↵Takeshi KOMIYA2021-04-191-2/+1
|/ | | | | | | in py37+ GenericAliasMixin should use `restify()` to render the metadata of GenericAlias as py36 does.
* Merge branch 'master' into refactor_type_annotation2Takeshi KOMIYA2021-04-081-12/+2
|\
| * Merge pull request #8841 from AWhetter/autodoc_signatures_without_backslashTakeshi KOMIYA2021-04-041-12/+2
| |\ | | | | | | Overloaded function signatures do not require a separating backslash
| | * Overloaded function signatures do not require a separating backslashAshley Whetter2021-03-271-12/+2
| | |
* | | refactor: use raw Type for type annotationsTakeshi KOMIYA2021-04-041-1/+1
|/ /
* | Use __init__ type hints in "description" modeMatt Wozniski2021-03-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Previously, `__init__` type hints were not used when documenting a class using `autodoc_typehints="description"`. This was done to prevent documentation for parameters from showing up twice, both for the class and the `__init__` special method. As the new ``autodoc_typehint_undoc`` option provides a better way to prevent this bad behavior by placing the user in control of where the type hints are added, it is now safe to add type hints for documented `__init__` parameters. Closes #8178
* | Add autodoc_typehint_undoc optionMatt Wozniski2021-03-272-2/+53
|/ | | | | | | | | | | | | | Previously, if autodoc_typehints="description", a :type: field would be added for every parameter and return type appearing in the annotation, including **kwargs and underscore-prefixed parameters that are meant to be private, as well as None return types. This commit introduces a new option, "autodoc_typehint_undoc". By default this option is True, requesting the old behavior. By setting this option to False, :type: and :rtype: fields will only be added for annotated parameters or return types if there is already a corresponding :param: or :return: field, to put users in control over whether a given parameter is documented or not.
* Close #5603: autodoc: Allow to refer to a python object using canonical nameTakeshi KOMIYA2021-03-271-0/+18
| | | | | | | | | | 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`).
* Deprecate DocumenterBridge.warn()Takeshi KOMIYA2021-03-221-0/+3
| | | | | | | | Since 1.6, sphinx.util.logging module became the default logging interface of Sphinx. It allows sphinx-components to output log without the app (or env) object. According to the policy, DocumenterBridge.warn() is no longer needed and should be replaced by the logging module.
* Rename DocumenterBridge.filename_set to record_dependenciesTakeshi KOMIYA2021-03-212-6/+12
| | | | | | | 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.
* refactor: Use PEP-526 based variable annotation (sphinx.ext)Takeshi KOMIYA2021-03-155-36/+36
|
* Merge pull request #8983 from tk0miya/7523_autodoc_propertyTakeshi KOMIYA2021-03-151-2/+14
|\ | | | | Fix #7383: autodoc: Support typehints for properties
| * Fix #7383: autodoc: Support typehints for propertiesTakeshi KOMIYA2021-03-131-2/+14
| | | | | | | | | | py:property directive now outputs py:property directive to describe its type annotation.
* | refactor: Add a type alias for the option_spec of directives; OptionSpecTakeshi KOMIYA2021-03-131-8/+10
|/
* Fix #759: autodoc: Add sphinx.ext.autodoc.preserve_defaults extensionTakeshi KOMIYA2021-03-062-0/+89
| | | | | | | | Add a new extension `sphinx.ext.autodoc.preserve_defaults`. It preserves the default argument values of function signatures in source code and keep them not evaluated for readability. This is an experimental extension and it will be integrated into autodoc core in Sphinx-4.0.
* Close #8924: autodoc: Support `bound` argument for TypeVarTakeshi KOMIYA2021-02-241-0/+2
|
* Merge branch '3.x'Takeshi KOMIYA2021-02-171-3/+3
|\
| * Fix #8883: autodoc: AttributeError on assigning __annotations__Takeshi KOMIYA2021-02-161-3/+3
| |
* | Merge branch '3.x' into merge_3.x_into_masterjfbu2021-02-041-1/+16
|\ \ | |/ | | | | | | Resolved Conflicts: sphinx/texinputs/sphinxpackagefootnote.sty
| * Merge pull request #8297 from pbudzyns/exclude-members-fixTakeshi KOMIYA2021-02-041-1/+16
| |\ | | | | | | Local autodoc options override or extend autodoc_default_options.
| | * Merge remote-tracking branch 'upstream/3.x' into exclude-members-fixpbudzyns2021-02-017-486/+1130
| | |\
| | * | check if autodoc_defaults are str, fix testspbudzyns2021-02-011-3/+3
| | | |
| | * | code formatpbudzyns2021-01-291-1/+2
| | | |
| | * | add private-members as extendablepbudzyns2021-01-291-1/+1
| | | |
| | * | local options handlingpbudzyns2021-01-291-2/+1
| | | |
| | * | redundant '+' has no effectpbudzyns2021-01-251-0/+5
| | | |
| | * | add more extendable options and testspbudzyns2021-01-251-1/+2
| | | |
| | * | add more extendable options and testspbudzyns2021-01-251-4/+8
| | | |
| | * | local exclude-members option fixroot2020-10-061-1/+6
| | | |
* | | | Merge branch '3.x' into master_with_merged_3.xjfbu2021-02-022-63/+53
|\ \ \ \ | |/ / /
| * | | Fix #8800: autodoc: Uninitialized attributes in superclass are recognized as ↵Takeshi KOMIYA2021-02-011-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | undocumented Unintentionally, uninitialized attributes defined at superclasses are recognized as undocumented in the filtering step. Therefore, they are filtered if `:undoc-members:` option given.
| * | | refactor: AttributeError handling for getslots() is not neededTakeshi KOMIYA2021-01-312-4/+4
| | | |
| * | | refactor: AttributeError handling for getall() is not neededTakeshi KOMIYA2021-01-311-4/+0
| | | |
| * | | refactor: AttributeError handling for getannotations() is not neededTakeshi KOMIYA2021-01-312-34/+20
| | | |
| * | | refactor: AttributeError handling for getmro() is not neededTakeshi KOMIYA2021-01-311-16/+13
| | |/ | |/| | | | | | | | | | | | | | | | | | | Internally, sphinx.util.inspect.getmro() uses `safe_getattr()` with the `default` keyword. Therefore it never raises AttributeError even if the subject raises an error on accessing `__mro__` attribute. This fixes the wrong its usage.
* | | Merge branch '3.x'Takeshi KOMIYA2021-01-283-8/+29
|\ \ \ | |/ /
| * | Fix #8134: autodoc: crashes when mocked decorator takes argumentsTakeshi KOMIYA2021-01-243-8/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | autodoc crashed when a decorator in mocked module takes arguments because mock system returns the first argument for the decorator as a decorated object. This changes the approach for mocking decorators that remembers arguments for each decoration, and fetch the latest argument on generating document.
* | | Merge branch '3.x'Takeshi KOMIYA2021-01-221-0/+31
|\ \ \ | |/ /
| * | Close #8514: autodoc: Default values of overloads are taken from actual ↵Takeshi KOMIYA2021-01-171-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch '3.x'Takeshi KOMIYA2021-01-161-1/+9
|\ \ \ | |/ /
| * | refactor: Deprecate DocumenterBrdige.reporterTakeshi KOMIYA2021-01-121-2/+8
| | | | | | | | | | | | | | | The logging system of Sphinx was migrated to sphinx.util.logging now. So it's time to deprecate reporter interface for Documenters.
* | | Merge branch '3.x'Takeshi KOMIYA2021-01-081-1/+4
|\ \ \ | |/ /
| * | Merge branch '3.4.x' into 3.xTakeshi KOMIYA2021-01-081-1/+4
| |\ \
| | * | Fix #8655: autodoc: Crashes when object raises an exception on hasattr()Takeshi KOMIYA2021-01-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | autodoc crashes when the target object raises an exception on `hasattr()`. The `hasattr()` function internally calls the `obj.__getattr__()` or `obj.__getattribute__()` of the target object. Hence the reaction can be changed on the target object. This starts to use `safe_getattr()` to check the object is mocked or not and to prevent an unexpected error.
* | | | Merge branch '3.x'Takeshi KOMIYA2021-01-017-7/+7
|\ \ \ \ | |/ / /
| * | | Merge branch '3.4.x' into 3.xTakeshi KOMIYA2021-01-017-7/+7
| |\ \ \ | | |/ /
| | * | A happy new year!Takeshi KOMIYA2021-01-017-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | .. 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
* | | | Merge branch '3.x'Takeshi KOMIYA2021-01-011-7/+28
|\ \ \ \ | |/ / /
| * | | refactor autodoc to adjust new AttributeDocumenterTakeshi KOMIYA2020-12-311-13/+8
| | | |
| * | | Merge branch '3.4.x' into merge_3.4.xTakeshi KOMIYA2020-12-311-4/+27
| |\ \ \ | | |/ /