Skip to content

Intersphinx catalog to link to the documentation #3354

Closed

Description

@gaborbernat

Any way we can generate an Intersphinx catalog one can use to automatically link to the documentation?

Something like this would work to patch it:

def setup(app: Sphinx) -> None:  # noqa: D103
    class PatchedPythonDomain(PythonDomain):
        def resolve_xref(  # noqa: PLR0913, PLR0917
            self,
            env: BuildEnvironment,
            fromdocname: str,
            builder: Builder,
            type: str,  # noqa: A002
            target: str,
            node: pending_xref,
            contnode: Element,
        ) -> Element:
            if target in fixup:
                return reference("", text=target.split(".")[-1], refuri=fixup[target], internal=False)
            return super().resolve_xref(env, fromdocname, builder, type, target, node, contnode)

    fixup = {
        "httpx.AsyncClient": "https://www.python-httpx.org/api/#asyncclient",
        "starlette.applications.Starlette": "https://www.starlette.io/applications/#instantiating-the-application",
        "starlette.datastructures.Secret": "https://www.starlette.io/config/#secrets",
        "starlette.testclient.TestClient": "https://www.starlette.io/testclient/",
    }
    app.add_domain(PatchedPythonDomain, override=True)

though unsure how to emphasize the URI 🤔

Activity

  1. lovelydinosaur commented on Oct 22, 2024

    @lovelydinosaur
    Member

    Discussion at #3091

    Yep... does anyone want to look into switching our code docstring support to mkdocstrings?

  2. added
    docs
    on Oct 22, 2024
  3. disastercurl commented on Oct 22, 2024

    @disastercurl

    Odd that I was just about to raise this very issue after stumbling through @gaborbernat's latest docs, as I'm trying to link documentation for a downstream module of httpx.

    An example of mkdocstrings own configuration can be seen here:
    https://github.com/mkdocstrings/mkdocstrings/blob/0.26.2/mkdocs.yml#L136-L163

    WIP changes at feature/mkdocstrings. Some concessions will need to be made between matching in with current mkautodocs format, and the options exposed by mkdocstrings. Some improvements to actual docstrings within the Python code (part tracked by #3355) should be made to improve the generated docs.

  4. pawamoy commented on Oct 26, 2024

    @pawamoy

    @Stealthii let me know if you open a PR, I'll have some comments and suggestions 🙂

  5. locked and limited conversation to collaborators on Feb 14, 2025
  6. converted this issue into a discussion #3505 on Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions