cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-117539: Link to the Python typing spec in typing docs

Open JelleZijlstra opened this issue 1 year ago • 7 comments

This sets up intersphinx and replaces a few PEP links in typing.rst with intersphinx links to the PEPs.

I'm going to ask in the Python Docs discord whether there are any concerns with enabling intersphinx on the Python docs, and wait for an answer before investing time into replacing the remaining links.

  • Issue: gh-117539

📚 Documentation preview 📚: https://cpython-previews--117540.org.readthedocs.build/

JelleZijlstra avatar Apr 04 '24 11:04 JelleZijlstra

From Petr's comments on Discord, it appears this may cause issues for redistributors (e.g., Linux distros) because it means that building the docs will require Internet access. I think I'll have to open a discussion on Discuss about it first.

JelleZijlstra avatar Apr 06 '24 12:04 JelleZijlstra

I can suggest some solutions:

  1. Provide a copy of the typing inventory. Internet connection is not needed if you have a local copy of the intersphinx inventory.
  2. I'm not sure if you really need the full power of intersphinx since most of the links you are referring to are sections or HTML pages that I doubt would change without you noticing it. For instance, in Sphinx, we have the same issue where we need to refer to the docutils specs but there is no intersphinx support for docutils, so we use sphinx.ext.extlinks instead. However, this is quite fragile against URL changes.

picnixz avatar Apr 06 '24 14:04 picnixz

Wouldn't it better to convert the pull request back to a draft? GitHub automatically prevents you from merging those.

nineteendo avatar Apr 26 '24 09:04 nineteendo

Since this can break people's build workflows, now -- before the first alpha -- is the best time to do it. I wouldn't backport it, though.

encukou avatar May 10 '24 14:05 encukou

Yeah, it also allows us to link to a specific section, rather than the start of the PEP (e.g. typing.overload).

nineteendo avatar May 10 '24 14:05 nineteendo

@encukou that's an option, but it would be a shame if we aren't able to make this change in the 3.12 and 3.13 docs. Ideally, we'd have a lot of cross-links to the spec.

Maybe at PyCon I can spend some time trying to figure out a robust solution based on @picnixz's suggestions.

JelleZijlstra avatar May 10 '24 15:05 JelleZijlstra

If intersphinx is a problem, we could maybe use canonical links for https://typing.readthedocs.io.

nineteendo avatar May 10 '24 16:05 nineteendo