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

Allow links to arbitrary intersphinx references #609

Open
adiroiban opened this issue Jul 12, 2022 · 7 comments · May be fixed by #764
Open

Allow links to arbitrary intersphinx references #609

adiroiban opened this issue Jul 12, 2022 · 7 comments · May be fixed by #764

Comments

@adiroiban
Copy link
Member

I think that pydoctor, at least with epydoc syntax only supports links from pydoctor to sphinx for API objects.

https://pydoctor.readthedocs.io/en/latest/sphinx-integration.html#linking-from-pydoctor-to-external-api-docs

There is no support for generic object reference

In Sphinx the syntax is

:external+otherbook:doc:`installation`

https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html


In pydoctor, the external search is implicit L{datetime.datetime} will search all external inventories for datetime.datetime reference.

We might want to implement something like L{:external+otherbook:doc:installation} to keep it as close as possible to the sphinx format

@tristanlatr
Copy link
Contributor

This is a hard one because our intersphinx inventory is absolutely not built with this in mind.

As a consequence, we don't have the "project name" which correspond to the inventory objects, because it's not necessary to lookup python objects. But to lookup narrative docs pages, we need to know on which project to look for, because all project will have a page named "install" or "quickstart", etc.

So this definitely needs more reflexion.

@tristanlatr
Copy link
Contributor

tristanlatr commented Jan 3, 2024

The logic should be adjusted so that:

  • The sphinx inventory support having several time the same python name if they belong to two different projects.
  • When linking to a name that is defined in several project, the linker bails and suggest to use the new syntax with the project specification because the current link is ambiguous.
  • All the entries (doc:, label:, etc) should be added to the project inventory as long as it does not override any defined python object, if it does simply print a message and ignore it.
  • The --intersphinx argument syntax should be augmented so we may pass the project name alongside its url. Like : --intersphinx=pydoctor:https://pydoctor.readthedocs.io/en/latest/objects.inv
  • The sphinx extension should be reviewed and potentially adjusted so pydoctor can link to the local sphinx pages automatically without the need to register another intersphinx url.
  • This last point might require the feature Intersphinx from local folder #741

What do you think @adiroiban ?

@tristanlatr
Copy link
Contributor

Also, to be compatible with sphinx, /objects.inv should be added automatically if missing.

@tristanlatr
Copy link
Contributor

I’ll first add support for these kind of link to the restructured text markup only since it’s easier to implement with the docutils roles. Then for epytext we’ll need to get creative. The main issue being the fact that names in the intersphinx mapping can contains colons. So making the difference in between the meta information and the link target might be difficult since the meta informations can contain one, two or three columns in the sphinx world.

@tristanlatr
Copy link
Contributor

I have an idea: what about introducing a new epytex markup R{} that would render the content using restructuredtext.
So these link would be rendered using R{:external+otherbook:doc:`installation`}

@adiroiban
Copy link
Member Author

The --intersphinx argument syntax should be augmented so we may pass the project name alongside its url. Like : --intersphinx=pydoctor:https://pydoctor.readthedocs.io/en/latest/objects.inv

I think that the .inv file format includes the project name.

But it's ok to have it as --intersphinx=pydoctor:https://pydoctor.readthedocs.io/en/latest/objects.inv to allow for renaming the project.


Also, to be compatible with sphinx, /objects.inv should be added automatically if missing.

This would be nice.
I am not sure how this can be implemented.
You can have the inventory at https://docs.python.org/3/py-inv.bin or just https://docs.python.org/3/api-inventory... if you don't set an extension for the file.


Yes. Having #741 would be nice.


I have an idea: what about introducing a new epytex markup R{} that would render the content using restructuredtext.
So these link would be rendered using R{:external+otherbook:doc:installation}

Not sure if this is a good idea.
This will make RST a hard requirement for epydoc.

Just my quick feedback.

Thanks for working on pydoctor :)

@tristanlatr
Copy link
Contributor

thanks for your inputs

Not sure if this is a good idea.
This will make RST a hard requirement for epydoc.

docutils is already a hard requirement for epytext. This would also fix some weaknesses of epytext like not being able to do tables or admonitions, but this can be implemented in a second phase.

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

Successfully merging a pull request may close this issue.

2 participants