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

Add intersphinx link when using autodoc and "show-inheritance": True #9420

Open
PhilipMay opened this issue Jul 7, 2021 · 8 comments
Open

Comments

@PhilipMay
Copy link

When I have set up intersphinx and use autodoc with "show-inheritance": True then something like this is generated:

Bases: transformers.trainer_callback.TrainerCallback

But transformers.trainer_callback.TrainerCallback is not a link. Just text.

Could you change this so a link is provided?

@tk0miya
Copy link
Member

tk0miya commented Jul 8, 2021

AFAIK, the feature you requested has already been implemented. I think this might be a bug or wrong settings. Could you share a reproducible (minimal) example?

@PhilipMay
Copy link
Author

PhilipMay commented Jul 8, 2021

AFAIK, the feature you requested has already been implemented. I think this might be a bug or wrong settings. Could you share a reproducible (minimal) example?

Sure! Thanks...

@PhilipMay
Copy link
Author

Here is a screenshot (see link above).

transformers.trainer_callback.TrainerCallback should be a link.

image

@PhilipMay
Copy link
Author

PhilipMay commented Jul 15, 2021

@tk0miya I linked an exmple and added a screenshot.
Can you please check this? I do not think that I misconfigured anything.

This link in the docstring works:

Class based on transformers.TrainerCallback

@PhilipMay
Copy link
Author

Code here:

class OptunaMLflowCallback(transformers.TrainerCallback):
    """Integration of Optuna and Transformers.

    Class based on :py:class:`transformers.TrainerCallback`; integrates with OptunaMLflow to send
    the logs to ``MLflow`` and ``Optuna`` during model training.
    """

@tk0miya
Copy link
Member

tk0miya commented Jul 17, 2021

I understand your problem. The upstream document only provides the document for transformers.TrainerCallback instead of transformers.trainer_callback.TrainerCallback. Indeed, it can't be referred.

Since Sphinx-4.0, we provides an option to describe the canonical name of the object. I believe this problem will be solved if the upstream project rebuilds document by latest release.

@miohtama
Copy link

miohtama commented Jul 31, 2021

Since Sphinx-4.0, we provides an option to describe the canonical name of the object. I believe this problem will be solved if the upstream project rebuilds document by latest release.

I tried to look up documentation on how the canonical name is supposed to behave. Do you need to annotate all the canonical names in the Intersphinx upstream project or are they automatically generated if Sphinx is updated and the upstream projects regenerated its Intersphinx inventory?

@tk0miya
Copy link
Member

tk0miya commented Aug 1, 2021

If the upstream project uses autodoc, it's automatically generated after the upgrade. On the other hand, additional annotations are needed if the upstream project has written their document manually using py:* directive (ex. py:class).
See https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#directive-py-class (:canonical: option).

@AA-Turner AA-Turner added this to the some future version milestone Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants