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
92e60b3f15
Fix PGH003 (type: ignore comment must have parameters)
2023-08-13 22:11:15 +01:00
Christoph Hasse
fca33a203d
Add additional `stringify_annotation
` tests ( #11027 )
2023-07-28 06:45:20 +01:00
Adam Turner
ad61e41157
Drop support for Python 3.8 ( #11511 )
2023-07-25 02:07:23 +01:00
Adam Turner
15553da9c8
Resolve lint errors from Ruff 0.0.260
2023-03-31 17:52:51 +01:00
Adam Turner
a13cf2c24d
Adopt `profile = "black"
for
isort
`
...
This allows using Ruff's import sorting fixers
2023-01-07 18:31:15 +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
8634fbce60
Adopt the Ruff code linting tool
...
https://github.com/charliermarsh/ruff
2022-12-29 17:00:27 +00: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
Takeshi KOMIYA
7e68154e49
Drop python 3.6 support ( #10468 )
2022-06-16 19:33:55 +01:00
Takeshi KOMIYA
017ef6118b
Merge branch '4.4.x' into 4.x
2022-03-19 22:56:54 +09:00
Takeshi KOMIYA
2f85b1a402
test: empty tuple type is now repesented w/o args since py3.11
...
refs: 15df8f8d89
2022-03-19 17:10:13 +09:00
Adam Turner
5775912455
Collapse single line docstrings
2022-02-20 03:13:45 +00:00
Adam Turner
6bb7b891a1
Remove copyright and licence fields
2022-02-20 03:06:23 +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
444e27865d
Fix #10133 : autodoc: Crashed when mocked module is used for type annotation
2022-01-30 23:19:55 +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
f38bd8e952
Merge branch '4.3.x' into 4.x
2022-01-01 20:02:10 +09:00
Takeshi KOMIYA
b84771dcd2
A happy new year!
2022-01-01 18:45:03 +09:00
Takeshi KOMIYA
6df45e0ead
Add mode
parameter to sphinx.util.typing:restify()
...
To make the typehints in "Bases" field simple, this adds a new parameter
`mode` to sphinx.util.typing:restify() to suppress the leading module
name from typehints in "Bases" field.
2022-01-01 14:24:43 +09:00
Takeshi KOMIYA
2ea9118181
refactor: Merge arguments of sphinx.util.typing:stringify()
2021-12-26 03:11:39 +09:00
Takeshi KOMIYA
bdbad40f57
Fix #9194 : autodoc: Prepend the "typing" module name on the signature
...
To create hyperlinks to container types automatically, this prepends the
module names for the types under "typing" module.
2021-12-26 01:04:40 +09:00
Takeshi KOMIYA
80f79aef91
Add smartref
parameter to sphinx.util.typing:stringify()
...
To make the generated function signatures simple, this adds a new
parameter `smartref` to sphinx.util.typing:stringify() to suppress the
leading module name from typehints.
2021-12-03 18:05:49 +09:00
Takeshi KOMIYA
0ea135e6d4
Merge branch '4.x' into 9657_qualname_of_mock
2021-09-27 01:58:44 +09:00
Takeshi KOMIYA
d13b86e02f
Close #9664 : autodoc: autodoc-process-bases supports reST snippet
...
This allows to inject a reST snippet through autodoc-process-bases
event. It helps to modify the base classes of any class to the expected
mark-up'ed text by custom extension.
2021-09-23 10:59:01 +09:00
Takeshi KOMIYA
e79efef63a
Fix #9657 : autodoc: basecls for a subclass of mocked object is incorrect
2021-09-21 02:03:31 +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
c5b35efce3
Close #9560 : autodoc: Allow to refer NewType with modname in py310+
...
Before 3.10, an instance of NewType has incorrect module name. But it
was fixed on 3.10. This starts to use the module info if the
interpreter is 3.10+.
2021-09-05 18:28:27 +09:00
James
596ad5523d
Merge branch '4.x' into 4.x
2021-08-02 00:32:14 +01:00
James
423b10a848
Add some tests
2021-08-02 00:20:08 +01:00
Takeshi KOMIYA
f9941b9402
Merge pull request #9464 from Gobot1234/4.x
...
Add support for PEP 585 generics
2021-07-20 01:14:12 +09:00
Takeshi KOMIYA
0565da6512
Fix testcases that failed in python3.10.0b4
2021-07-20 00:25:32 +09:00
James
451811c40c
Respond to feedback
2021-07-18 10:55:38 +01:00
Takeshi KOMIYA
007dee7590
Fix #9362 : autodoc: AttributeError is raised for a subclass of Tuple[()]
2021-07-07 09:13:44 +09:00
Takeshi KOMIYA
86091934db
Fix #9195 : autodoc: The args of typing.Literal
are wrongly rendered
...
They should be rendered as "repr" form.
2021-05-11 22:39:30 +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
8c7e779731
Fix #8992 : autodoc: Failed to resolve types.TracebackType type annotation
...
The builtin module, ``types.TracebackType`` does not have correct module
name. This allows to refer it automatically.
2021-03-17 23:37:43 +09:00
Takeshi KOMIYA
7d3cc382fa
autodoc: an imported TypeVar is not resolved (refs: #8415 )
...
So far, a TypeVar is rendered without module name. As a result, it
could not be resolved if it is imported from other modules. This
prepends its module name and make it resolvable. This is available
only in Python 3.7 or above.
As a side effect, all of TypeVars are displayed with module name. It
should be fixed in latter step (refs: #7119 )
2021-02-28 15:58:06 +09: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
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
f1a051fdfc
Fix #8315 : autodoc: Failed to resolve struct.Struct type annotation
...
The builtin module, ``struct.Struct`` does not have correct module
name since Python 3.8. This allows to refer it automatically.
2020-12-31 14:25:05 +09:00
Takeshi KOMIYA
423e7ab2ca
Fix #8559 : AttributeError is raised when using ForwardRef
...
The restify() helper crashes when ForwardRef is passed.
2020-12-22 00:37:02 +09:00
Takeshi KOMIYA
46a7ea7ada
Add NewType support to typing.stringify() and restify()
2020-11-21 23:04:42 +09:00