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

Close #5603: Autodoc: add :canonical: for everything #9039

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

flying-sheep
Copy link
Contributor

Feature or Bugfix

  • Feature

Purpose

cc @tk0miya

@flying-sheep
Copy link
Contributor Author

flying-sheep commented Mar 27, 2021

OK, one test fails, how should we fix it?

It happens in a newer Python (e.g. 3.9), in case of a TypeVar that’s a class attribute.

__qualname__ is not set, so the code falls back to __name__, which is wrong.

grafik

@tk0miya
Copy link
Member

tk0miya commented Apr 3, 2021

Could you let me know why do you add :canonical: options for everything? In my understanding, nobody refers the canonical functions, methods and others. I'd like to know the real usecase of this.

@flying-sheep
Copy link
Contributor Author

Everything can be initially defined in one module and be exported in another, not just classes.
As you can see in the test changes, it does happen!

Also I thought that one use case of this is that automatically generated reStructuredText code referring to f'{obj.__module__}.{obj.__qualname__}' works… Only inferring it for classes leaves it broken for functions and methods.

@flying-sheep
Copy link
Contributor Author

Hi @tk0miya what do you think?

@webknjaz
Copy link
Contributor

webknjaz commented Jan 4, 2023

@flying-sheep looks like this needs a rebase?

@tk0miya seems like this PR is awaiting your comment too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants