From 6ac2386bb12a9ed959c0b97a6f1e6914ce4a7ac4 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 4 Apr 2024 07:19:32 -0400 Subject: [PATCH 1/3] gh-117539: Link to the Python typing spec in typing docs --- Doc/conf.py | 7 +++++++ Doc/library/typing.rst | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index f4c75c5758cb281..dbac478cb326248 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -24,6 +24,7 @@ 'pyspecific', 'sphinx.ext.coverage', 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', ] # Skip if downstream redistributors haven't installed them @@ -55,6 +56,12 @@ manpages_url = 'https://manpages.debian.org/{path}' +# Intersphinx configuration +intersphinx_mapping = { + 'typing': ('https://typing.readthedocs.io/en/latest/', None), +} +intersphinx_disabled_reftypes = [] + # General substitutions. project = 'Python' copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation" diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 73214e18d556b2b..a92c83664df6597 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1494,7 +1494,8 @@ These can be used as types in annotations. They all support subscription using # and `year` of type `int`. def foo(**kwargs: Unpack[Movie]): ... - See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing. + See :ref:`the typing spec ` for more details on using + ``Unpack`` for ``**kwargs`` typing. .. versionadded:: 3.11 @@ -1610,7 +1611,7 @@ without the dedicated syntax, as documented below. Manually created type variables may be explicitly marked covariant or contravariant by passing ``covariant=True`` or ``contravariant=True``. By default, manually created type variables are invariant. - See :pep:`484` and :pep:`695` for more details. + See :ref:`the typing spec ` for more details. Bound type variables and constrained type variables have different semantics in several important ways. Using a *bound* type variable means @@ -1802,7 +1803,7 @@ without the dedicated syntax, as documented below. to ``call_soon`` match the types of the (positional) arguments of ``callback``. - See :pep:`646` for more details on type variable tuples. + See :ref:`the typing spec ` for more details on type variable tuples. .. attribute:: __name__ @@ -1902,8 +1903,7 @@ without the dedicated syntax, as documented below. be pickled. .. seealso:: - * :pep:`612` -- Parameter Specification Variables (the PEP which introduced - ``ParamSpec`` and ``Concatenate``) + * :ref:`typing:paramspec` -- typing specification for `ParamSpec` * :data:`Concatenate` * :ref:`annotating-callables` From 55df19beabeb47b03e44f1cc53aab5fb15b0b679 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 4 Apr 2024 07:22:13 -0400 Subject: [PATCH 2/3] not the default role --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index a92c83664df6597..37428b2170e8c69 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1903,7 +1903,7 @@ without the dedicated syntax, as documented below. be pickled. .. seealso:: - * :ref:`typing:paramspec` -- typing specification for `ParamSpec` + * :ref:`typing:paramspec` -- typing specification for ``ParamSpec`` * :data:`Concatenate` * :ref:`annotating-callables` From 1f90c872841c08ac9f37c91f47493457b8f4efb5 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 10 Apr 2025 07:06:39 -0700 Subject: [PATCH 3/3] Update Doc/conf.py Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/conf.py b/Doc/conf.py index 22121ee31cea639..68e66a3895422cc 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -70,7 +70,7 @@ # Intersphinx configuration intersphinx_mapping = { - 'typing': ('https://typing.readthedocs.io/en/latest/', None), + 'typing': ('https://typing.python.org/en/latest/', None), } intersphinx_disabled_reftypes = []