sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.41k stars 2.09k forks source link

`autodoc_type_aliases` not working when `autodoc_class_signature` is "separated". #10524

Open aaronhnsy opened 2 years ago

aaronhnsy commented 2 years ago

Describe the bug

When autodoc_class_signature is set to separated, a type alias config as follows

autodoc_type_aliases: dict[str, str] = {
    "BotT": "~discord.ext.commands.Bot | ~discord.ext.commands.AutoShardedBot",
    "ContextT": "~discord.ext.commands.Context",
    "PlayerT": "~slate.Player",
}

produces the following outputs:

Sunday 05 June 2022 at 00-48 chrome Lanky Sunday 05 June 2022 at 00-49 chrome Twin

However, when set to mixed, these same outputs look like:

Sunday 05 June 2022 at 00-51 chrome Unimportant Sunday 05 June 2022 at 00-51 chrome Courteous

How to Reproduce

$ git clone https://github.com/Axelware/slate
$ cd slate
$ poetry install -E dev -E docs
$ # change `autodoc_class_signature` in `conf.py` to `separated`.
$ cd docs
$ make html
$ # open _build/html/index.html

Expected behavior

This option shouldn't affect how the type aliases are mapped.

Your project

https://github.com/Axelware/slate

Screenshots

No response

OS

WIndows

Python version

3.10

Sphinx version

5.0.1

Sphinx extensions

sphinx.ext.autodoc, sphinx.ext.napoleon, sphinx.ext.intersphinx, sphinx.ext.extlinks, sphinxcontrib_trio, sphinx_copybutton, sphinx_inline_tabs

Extra tools

No response

Additional context

No response

AA-Turner commented 2 years ago

@Axelancerr can you add a minimal reproducer a la https://github.com/sphinx-doc/sphinx/issues/10497#issuecomment-1143060462? It makes it much easier to debug.

A

aaronhnsy commented 2 years ago

Hi, here's a paste for a minimal producer similar to the one you linked me: https://mystb.in/HunterHandbookBoards.python

(sorry, its a bit long)