Skip to content

Move typing-related usage of PEP585 generics from typing docs to collections.abc #123523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sterliakov opened this issue Aug 31, 2024 · 3 comments · Fixed by #123544
Closed

Move typing-related usage of PEP585 generics from typing docs to collections.abc #123523

sterliakov opened this issue Aug 31, 2024 · 3 comments · Fixed by #123544
Labels
docs Documentation in the Doc dir topic-typing

Comments

@sterliakov
Copy link
Contributor

sterliakov commented Aug 31, 2024

Documentation

As pointed out in #123521, currently we have typing-related usage of PEP585 generics (Generator, Callable, Coroutine, etc.) explained on typing page. However, those aliases are deprecated, and there's no backlink from their collections.abc counterparts.

So, currently all users of the recommended modern option (collections.abc generics) have no documentation regarding their use in typing context at hand. Worse, classes there don't even have their generic arguments listed - only the name:

class collections.abc.Generator

This clearly should be fixed. At minimum the following needs to hold:

  • collections.abc aliases have their generic arguments listed in the docs
  • All typing-related info from corresponding typing docs entries should be reachable from collections.abc docs.

Upon some thinking I agree with @ZeroIntensity that moving all information to collections.abc and only retaining deprecation warning with a link in typing docs could be the most ergonomic option.

Linked PRs

@sterliakov sterliakov added the docs Documentation in the Doc dir label Aug 31, 2024
@ZeroIntensity
Copy link
Member

@JelleZijlstra, as a typing expert, does this approach seem good to you?

@AA-Turner
Copy link
Member

As a user of collections generics, this would be quite useful, and seems appropriate now that Python 3.8 is nearing end-of-life. Happy to defer to others' views, though.

A

@sterliakov
Copy link
Contributor Author

I think +3 on the last comment is a good enough indicator - I'll grab this and open a PR soon.

AlexWaygood pushed a commit that referenced this issue Sep 6, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 6, 2024
…tines, and link to it from `collections.abc` docs (pythonGH-123544)

(cherry picked from commit 56e4a41)

Co-authored-by: Stanislav Terliakov <50529348+sterliakov@users.noreply.github.com>
AlexWaygood pushed a commit to AlexWaygood/cpython that referenced this issue Sep 6, 2024
…d coroutines, and link to it from `collections.abc` docs (python#123544)
AlexWaygood added a commit that referenced this issue Sep 6, 2024
…utines, and link to it from `collections.abc` docs (#123544) (#123792)

Co-authored-by: Stanislav Terliakov <50529348+sterliakov@users.noreply.github.com>
Yhg1s pushed a commit that referenced this issue Sep 6, 2024
…utines, and link to it from `collections.abc` docs (GH-123544) (#123790)

gh-123523: Rework typing documentation for generators and coroutines, and link to it from `collections.abc` docs (GH-123544)
(cherry picked from commit 56e4a41)

Co-authored-by: Stanislav Terliakov <50529348+sterliakov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir topic-typing
Projects
None yet
4 participants