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

Intersphinx from local folder #741

Open
miloth opened this issue Oct 12, 2023 · 6 comments · May be fixed by #764
Open

Intersphinx from local folder #741

miloth opened this issue Oct 12, 2023 · 6 comments · May be fixed by #764

Comments

@miloth
Copy link

miloth commented Oct 12, 2023

Hi,

We have some privately hosted repos and docs. We are trying to link to those during our docs generation by using locally cloned versions. Yet, if this is in the config:

intersphinx = [
    "https://docs.python.org/3/objects.inv",
    ...
    "<LOCAL-REPO-DIR>/objects.inv",
]

pydoctor throws the following warning:

Failed to uncompress inventory from <LOCAL-REPO-DIR>

Is there a way to add references to local files, like with the intershinx-mapping option of sphinx:

intersphinx_mapping = {"<PACKAGE-NAME>": ("<DOCS-PRIVATE-URL>", "<LOCAL-REPO-DIR>/objects.inv")}

The path to the inv file could be absolute or relative, no real preference on what is more convenient.

Thanks!

@tristanlatr
Copy link
Contributor

Hello @miloth,

There is currently no way to include local objects.inv file. But support for this could be relatively easy to add. Maybe adding an new option —intersphinx-file.

Looking at the file sphinx.py would be a good starting point.

@tristanlatr
Copy link
Contributor

Better, we could simply add support for the file:// scheme.

@miloth
Copy link
Author

miloth commented Nov 1, 2023

Hi @tristanlatr, thanks for the response and the suggestions. I don't have hours available to allocate to this, but I will get back to it if I find some.

I don't know if the url file:// scheme will work, because the links in the compiled docs should point to the private URL where the dependency is hosted, not where the local objects.inv files are fetched for the intershpinx at docs compile.

@tristanlatr
Copy link
Contributor

I don't know if the url file:// scheme will work, because the links in the compiled docs should point to the private URL where the dependency is hosted, not where the local objects.inv files are fetched for the intershpinx at docs compile.

I think the is a misunderstanding, I’m not proposing to generate links with the file:// scheme, but to use the file:// scheme in the intersphinx list configuration to differentiate local and remote objects.inv. But, thinking about it twice: it’s probably misguided because the file:// scheme theoretically also support providing a remote host to fetch the file from…

Any opinion about this @glyph ?

@glyph
Copy link
Member

glyph commented Nov 6, 2023

But, thinking about it twice: it’s probably misguided because the file:// scheme theoretically also support providing a remote host to fetch the file from…

Any opinion about this @glyph ?

technically speaking, file://host/.../ is valid, but the only practical way to interpret this is a UNC pathname, which is local…enough, I guess. I think using this URI scheme is a good way to disambiguate, and if you want to be careful to not open up an esoteric minor vulnerability that could cause a user's machine to reach out to a surprising UNC host, you can just enforce that the host of the file URI is '' before passing it on.

@tristanlatr
Copy link
Contributor

Easier: if the string doesn’t contain  :// then it’s treated like a file. This is how Sphinx handles it.

@tristanlatr tristanlatr linked a pull request Mar 2, 2024 that will close this issue
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.

3 participants