gh-117539: Link to the Python typing spec in typing docs#117540
gh-117539: Link to the Python typing spec in typing docs#117540JelleZijlstra wants to merge 5 commits intopython:mainfrom
Conversation
|
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. |
|
I can suggest some solutions:
|
|
Wouldn't it better to convert the pull request back to a draft? GitHub automatically prevents you from merging those. |
|
Since this can break people's build workflows, now -- before the first alpha -- is the best time to do it. |
|
Yeah, it also allows us to link to a specific section, rather than the start of the PEP (e.g. |
|
If intersphinx is a problem, we could maybe use canonical links for https://typing.readthedocs.io. |
|
Looping back around to this: @JelleZijlstra @encukou Thoughts on next steps now that some time has gone by? |
|
I'd like this to happen but I don't know if I'll have time to push for and implement a robust solution. I'd be happy if someone else did, though. |
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
This PR is stale because it has been open for 30 days with no activity. |
|
Testing an offline build (having first done ❯ make -C Doc html
mkdir -p build
blurb version 2.0.0
sphinx-build 8.2.3
Building NEWS from Misc/NEWS.d with blurb
PATH=./venv/bin:$PATH sphinx-build --builder html --doctree-dir build/doctrees --jobs auto --fail-on-warning . build/html
Running Sphinx v8.2.3
loading translations [en]... done
matplotlib is not installed, social cards will not be generated
making output directory... done
loading intersphinx inventory 'typing' from https://typing.python.org/en/latest/objects.inv ...
WARNING: failed to reach any of the inventories with the following issues:
intersphinx inventory 'https://typing.python.org/en/latest/objects.inv' not fetchable due to <class 'requests.exceptions.ConnectionError'>: HTTPSConnectionPool(host='typing.python.org', port=443): Max retries exceeded with url: /en/latest/objects.inv (Caused by NameResolutionError("HTTPSConnection(host='typing.python.org', port=443): Failed to resolve 'typing.python.org' ([Errno 8] nodename nor servname provided, or not known)"))
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 545 source files that are out of date
updating environment: [new config] 545 added, 0 changed, 0 removed
reading sources... [100%] whatsnew/2.1 .. whatsnew/index
looking for now-outdated files... none found
pickling environment... done
checking consistency... /Users/hugo/github/python/cpython/main/Doc/howto/argparse.rst: document is referenced in multiple toctrees: ['howto/index', 'library/argparse'], selecting: library/argparse <- howto/argparse
done
preparing documents... done
copying assets...
copying downloadable files... [100%] includes/tzinfo_examples.py
copying static files...
Writing evaluated template result to /Users/hugo/github/python/cpython/main/Doc/build/html/_static/basic.css
Writing evaluated template result to /Users/hugo/github/python/cpython/main/Doc/build/html/_static/language_data.js
Writing evaluated template result to /Users/hugo/github/python/cpython/main/Doc/build/html/_static/documentation_options.js
Writing evaluated template result to /Users/hugo/github/python/cpython/main/Doc/build/html/_static/classic.css
Writing evaluated template result to /Users/hugo/github/python/cpython/main/Doc/build/html/_static/sidebar.js
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
/Users/hugo/github/python/cpython/main/Doc/library/typing.rst:1729: WARNING: undefined label: 'typing:unpack-kwargs' [ref.ref]
/Users/hugo/github/python/cpython/main/Doc/library/typing.rst:1840: WARNING: undefined label: 'typing:variance' [ref.ref]
/Users/hugo/github/python/cpython/main/Doc/library/typing.rst:2088: WARNING: undefined label: 'typing:typevartuple' [ref.ref]
/Users/hugo/github/python/cpython/main/Doc/library/typing.rst:2248: WARNING: undefined label: 'typing:paramspec' [ref.ref]
writing output... [100%] whatsnew/3.8 .. whatsnew/index
generating indices... genindex py-modindex done
writing additional pages... download index search opensearch done
copying images... [100%] using/win_install_freethreaded.png
dumping search index in English (code: en)... done
dumping object inventory... done
Writing glossary.json
profiling_trace: Injected 38 trace events into profiling-sampling-visualization.js
Linklint: unlinked 3575 refs: 1982 duplicate, 1593 self
build finished with problems, 5 warnings (with warnings treated as errors).
make: *** [build] Error 1The make command exits with an error -- but that's only because we have And there's some warnings, but the docs finishing building and things like: See :ref:`the typing spec <typing:unpack-kwargs>` for more details on using
``Unpack`` for ``**kwargs`` typing.Render as plain text:
Which is fine. But: * :ref:`typing:paramspec` -- typing specification for ``ParamSpec``Renders as:
Instead of:
Which isn't as good, but I think this is okay overall. Especially as most people visit http://docs.python.org, and the docs still build and make sense for offline rebuilds that have a much smaller readership. Alternatively we could bundle the Or we could make a Sphinx extension to handle missing intersphinx and fallback in some other way. |
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.
📚 Documentation preview 📚: https://cpython-previews--117540.org.readthedocs.build/