Skip to content

importlib documentation doesn't declare functions properly #125018

Description

@ncoghlan

https://docs.python.org/3/library/importlib.metadata.html#distribution-versions doesn't actually define a Sphinx function for version, so attempted references with `:func:`importlib.metadata.version` (including via the intersphinx extension) fail.

Edit: fixed the backticks thanks to @serhiy-storchaka's tip below (TIL that you can use repeated backticks with trailing and leading space for inline code markup, allowing inclusion of single backticks in the quoted code)

Linked PRs

Activity

  1. serhiy-storchaka commented on Oct 6, 2024

    @serhiy-storchaka
    Member

    Use triple backticks :func:`importlib.metadata.version`.

  2. webknjaz commented on Oct 6, 2024

    @webknjaz
    Member

    @serhiy-storchaka nope, @ncoghlan is right. For the full list of exposed objects, I have this little helper that updates every several hours: https://webknjaz.github.io/intersphinx-untangled/docs.python.org/.

    And the terminal way to see what's exposed would be python -Im sphinx.ext.intersphinx https://docs.python.org/en/3/objects.inv.

    These references don't come from Python runtime but from Sphinx. They must be properly declared in Sphinx in order to be linkable.

    Single backticks work depending on Sphinx config. In that case, it's because of default_role = 'any' that Sphinx attempts finding any object of any role matching the name in intersphinx (and the site-local domain).

  3. serhiy-storchaka commented on Oct 6, 2024

    @serhiy-storchaka
    Member

    I meant that you can use triple quotes to quote text containing single or double backquotes in Markdown.

  4. ncoghlan commented on Oct 6, 2024

    @ncoghlan
    ContributorAuthor

    I fixed the initial post to avoid requiring imagination of the actual reference syntax (thanks to @serhiy-storchaka's tip, I learned something new about Markdown today: https://meta.stackexchange.com/questions/82718/how-do-i-escape-a-backtick-within-in-line-code-in-markdown ).

  5. self-assigned this
    on Oct 6, 2024
  6. added a commit that references this issue on Oct 6, 2024
  7. ncoghlan commented on Oct 6, 2024

    @ncoghlan
    ContributorAuthor

    Posted a PR that adds the minimal text needed to define valid semantic cross-reference targets. The phrase "as described below" features heavily in their descriptive text, since I didn't want to embark on a wholesale rewrite of the module docs just to fix a cross-referencing issue.

  8. webknjaz commented on Oct 6, 2024

    @webknjaz
    Member

    I fixed the initial post to avoid requiring imagination of the actual reference syntax (thanks to @serhiy-storchaka's tip, I learned something new about Markdown today: meta.stackexchange.com/questions/82718/how-do-i-escape-a-backtick-within-in-line-code-in-markdown ).

    One stray backtick still renders for me, though..

  9. added 3 commits that reference this issue on Oct 7, 2024
  10. added 2 commits that reference this issue on Oct 7, 2024
  11. added a commit that references this issue on Oct 7, 2024
  12. added 2 commits that reference this issue on Oct 7, 2024
  13. added a commit that references this issue on Oct 8, 2024
  14. added a commit that references this issue on Oct 8, 2024
  15. ncoghlan commented on Oct 8, 2024

    @ncoghlan
    ContributorAuthor

    Thanks for the syntax cleanups @AA-Turner (I incorrectly assumed that Sphinx would error on the !~ syntax if it didn't understand it, missing the possibility that it might just treat everything after the ! as a plain text string to pass through to the rendered output, which is what actually happened).

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

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dir

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions