-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Put qualname in the objects.inv #4826
Comments
Please let me know your goal. The inventory file of intersphinx is generated for cross reference. |
Yes, since there is no automatic way of knowing what the “canonical” place for an object is. |
@tk0miya do you need more information? I’d do a PR, but I don’t know enough about the inner workings here and how to start best. |
Sorry for late response. I feel a bit strange for your proposal. I think the qualified names are not undocumented. That means it is private members. I don't think it is good way to expose qualified names automatically. |
You’re right, but I didn’t propose to just add the qualname to the objects.inv. I do want a solution for the case where I know the qualname but not the canonical documentation location. Each documented object has 1–∞ aliases, one of which is the the canonical documented location (in objects.inv) and one of which is the canonical qualified name ( I don’t think it’s necessary to support all alias names, just the qualified name as well as the documented one. I can imagine two solutions, but maybe there are more:
The latter would be much more practical, because people won’t have to change autodoc templates and so on, also it would be faster and work without having access to and implementing other modules. The former would work without rebuilding every other project’s documentation. |
Most important thing is whether the author of the document want to expose the qualname to readers. I can agree with adding an option for it if they want. |
i think you didn’t understand me. the point is that sometimes someone just has the qualname and needs to get a link out of the objects.inv using it. nobody will ever see the qualname, it’s just for finding a class or function in the docs: using the qualname, you shoud be able to get a link to the documented location. the link should look like if you used the documented location. this is about an implementation detail and enhanced functionality, not design, so an option would be counter productive, annoying, and have no benefit. |
so what do you think is the best approach (from my second-to-last comment)? 1 or 2? |
If we'll expose qualname into objects.inv, users can refer objects using qualified name like I'm afraid of that the exposure causes the document network fragile. I can understand it is useful for IDE or tooling, but... |
Actually this is not a problem. The qualname will only appear
the links that appear in the HTML will point to the documented name. e.g.
|
A big +1 from me. Without this, the Sphinx documentation for projects that uses type annotations are broken, with no workaround. In fact, this is one reason why I think people should stay away from type annotations for the time being. |
Sorry for late. @flying-sheep Finally I can understand your goal. Thank you for explanation. I agree to add qualnames to inventory as alias. I think they should be also added into internal indices data; which is origin of inventory file. Because other extension would also be able to refer it by qualname. |
Great to hear! Merry Christmas! |
It’s one year later. Merry Christmas and a happy new year again! 😉
Actually scanpydoc.elegant_typehints has a (manual) workaround (check the docs for |
Related to #5589 I think |
Now I merged #9026 that generates |
Great, thank you so much! This will help in many many cases. This PR is only a partial solution for autodoc though, as it only touches the class documenter. What about
Let’s fix up #9039 |
Due to type annotations, more and more tools retrieve qualified object names from live objects and expect them to serve as object ID.
However, code like the following fails when the object is reexported, when its canonical location doesn’t fit its qualified name:
a fix could either go into the inventory dumping or the python domain (if adding objects goes through a domain API and isn’t just doing
env.domains['py'].objects.append(…)
)The text was updated successfully, but these errors were encountered: