Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python_use_unqualified_type_names does not work on function descriptions #9268

Closed
felix-hilden opened this issue May 25, 2021 · 0 comments
Closed
Labels
domains:py type:proposal a feature suggestion
Milestone

Comments

@felix-hilden
Copy link

Describe the bug
When combining the new python_use_unqualified_type_names configuration with autodoc_typehints='description', the type names are not shortened even though links are created.

To Reproduce
Here's a minimal project using Sphinx 4.0.2 on Python 3.9:

# conf.py
import os
import sys
from pathlib import Path

# Insert source parent folder to path
_root = Path(os.path.realpath(__file__)).parent.parent
sys.path.insert(0, str(_root))

extensions = ['sphinx.ext.autodoc']
master_doc = 'index'
exclude_patterns = ['_build']

autodoc_typehints = 'description'
python_use_unqualified_type_names = True
# package.py
class A:
    pass

class B:
    def __init__(self, a: A):
        self.a = a
.. index.rst

Package
=======

.. autoclass:: package.A
.. autoclass:: package.B

This produces documentation looking like this:

doc

Expected behavior
I'd expect the link to be shortened to A like it is when autodoc_typehints='signature'.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Jun 2, 2021
@tk0miya tk0miya added this to the 4.1.0 milestone Jun 2, 2021
@tk0miya tk0miya added type:proposal a feature suggestion and removed type:bug labels Jun 2, 2021
@tk0miya tk0miya closed this as completed in 90470b0 Jun 3, 2021
tk0miya added a commit that referenced this issue Jun 3, 2021
…e_names

Close #9268: python_use_unqualified_type_names supports type field
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
domains:py type:proposal a feature suggestion
Projects
None yet
Development

No branches or pull requests

2 participants