[issue46494] Mention typing_extensions in the typing documentation

New submission from Jelle Zijlstra <jelle.zijlstra@gmail.com>: I've often seen people say things like "I can't use TypeGuard yet, I'm stuck on 3.9". That's not true, because the typing_extensions package backports all typing features to all supported Python versions. To help make people aware of this option, we should mention typing_extensions in https://docs.python.org/3.10/library/typing.html. Perhaps this can go in the "Relevant PEPs" section, or at the end of the intro section. Suggested wording: "New features have been added to the typing module in each major version of Python. The typing extensions (link to GitHub) package provides backports to all supported versions of Python 3 for almost all of these features." ---------- assignee: docs@python components: Documentation messages: 411434 nosy: AlexWaygood, Jelle Zijlstra, docs@python, gvanrossum, kj, sobolevn, srittau priority: normal severity: normal status: open title: Mention typing_extensions in the typing documentation versions: Python 3.10, Python 3.11, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Alex Waygood <Alex.Waygood@Gmail.com> added the comment: Sounds like a great idea. I like the idea of putting it in the "Relevant PEPs" section, as that section already details how the typing module has evolved over the past few major versions of Python. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Sebastian Rittau <srittau@rittau.biz> added the comment: Sounds like a good idea. I would put it into the introduction. I hear it will easily be missed in other sections. Wouldn't a link to PyPI make more sense than a GitHub link? ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Ken Jin <kenjin4096@gmail.com> added the comment: Yes please, this is a great idea. ---------- keywords: +easy, newcomer friendly _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Change by Guido van Rossum <guido@python.org>: ---------- nosy: -gvanrossum _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Meer Suri <meersuri@gmail.com> added the comment: (First time contributor looking for guidance) Is this diff okay? I'm not sure if the package name should be typing-extensions, or if the formatting is okay diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 94a46b01a1..c0fe656c1c 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -32,6 +32,11 @@ In the function ``greeting``, the argument ``name`` is expected to be of type :class:`str` and the return type :class:`str`. Subtypes are accepted as arguments. +New features have been added to the typing module in each major version of +Python. The `typing_extensions <https://pypi.org/project/typing-extensions/>`_ +package provides backports to all supported versions of Python 3 for almost +all of these features. + .. _relevant-peps: Relevant PEPs ---------- nosy: +meersuri _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Jelle Zijlstra <jelle.zijlstra@gmail.com> added the comment: Welcome to this project, Meer! That looks pretty good, feel free to submit a PR. We can then perhaps get feedback from more people to improve the wording. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Change by Meer Suri <meersuri@gmail.com>: ---------- keywords: +patch pull_requests: +29426 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31260 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Jelle Zijlstra <jelle.zijlstra@gmail.com> added the comment: New changeset 8debeed3075bf4d7e568e65da16bec63cf276f4f by Meer Suri in branch 'main': bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260) https://github.com/python/cpython/commit/8debeed3075bf4d7e568e65da16bec63cf2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Jelle Zijlstra <jelle.zijlstra@gmail.com> added the comment: Thanks for the patch! ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- nosy: +miss-islington nosy_count: 7.0 -> 8.0 pull_requests: +29862 pull_request: https://github.com/python/cpython/pull/31746 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +29863 pull_request: https://github.com/python/cpython/pull/31747 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset e053f0e9f41791095a924e2aceaaa025a058ed57 by Miss Islington (bot) in branch '3.10': bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260) https://github.com/python/cpython/commit/e053f0e9f41791095a924e2aceaaa025a05... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________

miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 0c718e02f60f98275c62e8a2a152f086650e88ea by Miss Islington (bot) in branch '3.9': bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260) https://github.com/python/cpython/commit/0c718e02f60f98275c62e8a2a152f086650... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue46494> _______________________________________
participants (7)
-
Alex Waygood
-
Guido van Rossum
-
Jelle Zijlstra
-
Ken Jin
-
Meer Suri
-
miss-islington
-
Sebastian Rittau