Status of PEP 649 - deferred evaluation of annotations

Hello!
I am trying to ramp up on typing, and see where things are going.
It looks like PEP 649 was accepted for Python3.13, and the announcement mentions that it should happen “reasonably soon” after Python3.12b1 (May 2023).
8 months have passed, and Python3.13 feature freeze is 3.5 months away. I searched the topics here, but also the steering council notes, the CPython commits and the 3.13 news, but could not find any mention of PEP 649 since then.
Did I miss anything or is the status still “should be merged before beta1”?

Thanks!

8 Likes

It’s still expected to happen in time for Python 3.13. I contacted Larry Hastings a little while ago and he assured me it would be implemented in time.

11 Likes

What would be the best way to be updated on this PEP? I have a Python library that relies on type annotations (and we’ve done some work for future annotations) so I’d love to test PEP 649 as early as possible :blush:

1 Like

If you’d like to play with the functionality now, pyright has provisional support for PEP 649. If you specify that you’re using Python 3.13, pyright will assume that type annotation evaluation will be deferred.

Code sample in pyright playground

def func() -> A:
    return A()

class A:
    pass

2 Likes

Last year the steering council did not want to land PEP 649 right before Python 3.12 beta 1. There is now only one alpha release left for Python 3.13.

Can it be assumed if PEP 649 does not land in the next few weeks that it will be delayed to Python 3.14?

1 Like

An updated implementation is being actively worked on and the release manager is in the loop. If it isn’t ready in time, we’re not worried, it’ll just be delayed to 3.14.

5 Likes

Did the PEP land? I didn’t see it mentioned in beta 1 release notes.

Nope, it did not. It will be ready for 3.14.

5 Likes

Good to know. These changes are likely to affect our project, we process annotations at run time, and I want to test them as soon as possible. Hopefully they are in early 3.14 alphas already.

2 Likes

Implementation has now already partially landed for 3.14:

6 Likes