Skip to content

Implement PEP 647 (User-Defined Type Guards) in typing.py #87932

Closed

Description

@Fidget-Spinner
BPO 43766
Nosy @gvanrossum, @rhettinger, @Fidget-Spinner
PRs
  • bpo-43766: Implement PEP 647 (User-Defined Type Guards) in typing.py #25282
  • bpo-43766: Fix TypeGuard docs #25660
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-04-27.15:59:43.758>
    created_at = <Date 2021-04-07.14:27:50.266>
    labels = ['library', '3.10']
    title = 'Implement PEP 647 (User-Defined Type Guards) in typing.py'
    updated_at = <Date 2021-04-27.15:59:43.757>
    user = 'https://github.com/Fidget-Spinner'

    bugs.python.org fields:

    activity = <Date 2021-04-27.15:59:43.757>
    actor = 'kj'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-04-27.15:59:43.758>
    closer = 'kj'
    components = ['Library (Lib)']
    creation = <Date 2021-04-07.14:27:50.266>
    creator = 'kj'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43766
    keywords = ['patch']
    message_count = 6.0
    messages = ['390436', '390458', '390537', '392078', '392095', '392097']
    nosy_count = 3.0
    nosy_names = ['gvanrossum', 'rhettinger', 'kj']
    pr_nums = ['25282', '25660']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43766'
    versions = ['Python 3.10']

    Activity

    1. Fidget-Spinner commented on Apr 7, 2021

      @Fidget-Spinner
      MemberAuthor

      PEP-647 was recently accepted by the SC:
      https://mail.python.org/archives/list/[email protected]/thread/2ME6F6YUVKHOQYKSHTVQQU5WD4CVAZU4/

      I'd like to work on the implementation for typing.py and any required docs later on (unless someone is already working on it, then I hope you'd let me help too ;). Hopefully I can get it in before the 3.10 beta freeze.

      typing_extensions will need a port too, though that is much less urgent at the moment.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Apr 7, 2021
    3. gvanrossum commented on Apr 7, 2021

      @gvanrossum
      Member

      Go for it! I assume that this will be pretty simple, right? TypeGuard[X] should show up in __annotations__ as exactly that. It can be implemented in pure Python.

    4. Fidget-Spinner commented on Apr 8, 2021

      @Fidget-Spinner
      MemberAuthor

      I assume that this will be pretty simple, right?

      Yep! The PR speaks for itself ;). typing.py has pretty nice internal constructs to make these types of additions a breeze. I'm really grateful to whoever wrote/refactored the _SpecialForm decorator to what it is today.

    5. gvanrossum commented on Apr 27, 2021

      @gvanrossum
      Member

      New changeset 05ab4b6 by Ken Jin in branch 'master':
      bpo-43766: Implement PEP-647 (User-Defined Type Guards) in typing.py (bpo-25282)
      05ab4b6

    6. gvanrossum commented on Apr 27, 2021

      @gvanrossum
      Member

      New changeset 99fdd78 by Ken Jin in branch 'master':
      bpo-43766: Fix TypeGuard docs (bpo-25660)
      99fdd78

    7. Fidget-Spinner commented on Apr 27, 2021

      @Fidget-Spinner
      MemberAuthor

      Guido, thanks so much for reviewing the docs for TypeGuard so thoroughly even with how busy you are. I hope you enjoy your upcoming vacation :).

      I'm closing this issue as all PRs have landed. Please don't hesitate to re-open this if you feel something's amiss. Thanks!

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions