-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Intersphinx Mapping link not working with Plotly objects in signature #473
Comments
Are there supposed to be images in this? |
Yes… they rendered correctly in my web browser, don’t know why it does not here. I will re-upload them |
Could you also provide your |
You should set
The problem is that
|
Sure, you can find the original |
Oh I see, but then I would need to patch Plotly's code, not mine. But thanks for helping! I guess the way they import classes is quite convoluted... |
Maybe you should open an issue on plotly about this. I personally think it is a bug in my libraries if But inevitably there are going to be a lot of libraries that define objects in private modules and reexport them without fixing up their names like this. On our side, I think it would make sense to add a hook to module = module_name_fixup_hook(get_annotation_module(annotation)) and |
Looks like function configs are not very well supported by sphinx's caching system though, so setting such a configuration option to a nondefault value would mean that it always rebuilds. |
This adds a configuration option that allows the user to rewrite module names if needed. Resolves tox-dev#473. Note that we also rewrite the names of `_io` and `typing_extensions` internally. One benefit of this hook is that if other similar rewrites are needed, users will be able to immediately add them without having to patch sphinx_autodoc_typehints itself. One disadvantage is that by default, having a function in the config prevents caching. I think this can be handled with the following slightly inelegant hack: ```py class ModuleNameRewriteHook: version: int def __eq__(self, other): return type(self) == type(other) and self.version == other.version def __init__(self): self.version = 2 def __call__(self, module): # logic here # Make sure to bump version if you edit this so that sphinx will rerun. return module typehints_fixup_module_name = ModuleNameRewriteHook ``` See sphinx-doc/sphinx#12300.
This adds a configuration option that allows the user to rewrite module names if needed. Resolves tox-dev#473. Note that we also rewrite the names of `_io` and `typing_extensions` internally. One benefit of this hook is that if other similar rewrites are needed, users will be able to immediately add them without having to patch sphinx_autodoc_typehints itself. One disadvantage is that by default, having a function in the config prevents caching. I think this can be handled with the following slightly inelegant hack: ```py class ModuleNameRewriteHook: version: int def __eq__(self, other): return type(self) == type(other) and self.version == other.version def __init__(self): self.version = 2 def __call__(self, module): # logic here # Make sure to bump version if you edit this so that sphinx will rerun. return module typehints_fixup_module_name = ModuleNameRewriteHook ``` See sphinx-doc/sphinx#12300.
Thanks for your help @hoodmane :-) ! |
Hello,
For some (unknown) reasons, it appears that Sphinx does not correctly link to the objects if they were defined in the signature. I would love to have all my external references actually work.
The following code
produces:
As you can see, the handwritten reference to
Figure
is clickable, but not the one from the signature.This is also in other online documentation, see plot_terminator_improvement from the Neptuna Python package:
In this function, I return one of three possible plot types, and we can clearly see that the only one failing is the Plotly one:
See original doc: https://differt.eertmans.be/v0.0.12/reference/differt.plotting.html#differt.plotting.process_plotly_kwargs
The text was updated successfully, but these errors were encountered: