PEP-649 has been accepted and should be implemented in Python 3.14. Let's use this issue to track the implementation: - [x] Decide on or clarify the adoption strategy (https://discuss.python.org/t/pep-649-deferred-evaluation-of-annotations-tentatively-accepted/21331/44) - [x] Add new `__annotate__` attributes #119209 - [x] Implement core interpreter changes (e.g., new symbol table functionality) #119361 - [x] Implement new Python-level APIs, like the new `format` argument to `inspect.get_annotations` #119891 - [x] (PEP-649 specifies that `inspect.AnnotationsFormat` should be a "global enum". Is that desirable? TBD. https://github.com/python/cpython/pull/119361/files#r1614753031) - [x] Document the new semantics #122235 - [ ] Add higher-level documentation, e.g. a migration guide away from `from __future__ import annotations`; an introduction to annotationlib; an update to Larry's annotations HOWTO - [ ] The SC would like https://peps.python.org/pep-0749/#appendix incorporated into the docs - [x] Make staticmethod and classmethod not force evaluation of annotations #119864 - [x] Adapt standard library code that uses annotations to work excellently with PEP 649 - [x] dataclasses #119891 - [x] typing.py: TypedDict, NamedTuple, try to remove dependency on `inspect`. (If it can't be removed, get rid of the awkward dance we do for `typing.Protocol` to import `inspect.getattr_static` lazily.) - [x] singledispatch #119891 - [x] Also make it only evaluate the relevant parameter, https://github.com/python/cpython/pull/119891#discussion_r1636397226 - [x] functools.update_wrapper #119891, #124342 - [x] Add PEP 649-like functionality to TypeAliasType, TypeVar, etc. (`pep649-typevar` branch in my fork) - [ ] Make sure the ecosystem is ready by testing third-party libraries like Pydantic - [x] typing_extensions: needs changes similar to those in typing.py (python/typing_extensions#412) - [ ] beartype: had various unrelated problems on 3.13 (beartype/beartype#387); a few additional tests fail on the PR branch due to direct manipulation of `__dict__` - [ ] typeguard: some unrelated 3.13 problems (agronholm/typeguard#460); no test failures related to PEP 649 - [ ] pyanalyze: some unrelated 3.13 issues and a few changes necessary due to direct `__dict__` access (quora/pyanalyze#773) - [ ] pydantic: failed to build for 3.14 so far - [ ] Optimize the implementation. Ideas: - [ ] Avoid creation of function objects and store only code objects instead #124157 - [x] Avoid creation of AST nodes and use of eval() for ForwardRefs that are just names #124337 Things to revisit: - [x] Should FORWARDREF be the default? https://github.com/beartype/beartype/pull/440#issuecomment-2373086020 - [x] Add VALUE_WITH_FAKE_GLOBALS format - [x] Name of `__annotate__` parameter - [x] Should setting `__annotations__` invalidate `__annotate__`? - [x] Rename SOURCE to STRING? I am planning to work on the interpreter core first. cc @larryhastings @carljm @samuelcolvin <!-- gh-linked-prs --> ### Linked PRs * gh-119209 * gh-119321 * gh-119361 * gh-119397 * gh-119864 * gh-119891 * gh-120719 * gh-120816 * gh-122074 * gh-122210 * gh-122212 * gh-122235 * gh-122365 * gh-122366 * gh-124326 * gh-124337 * gh-124393 * gh-124415 * gh-124461 * gh-124479 * gh-124561 * gh-124620 * gh-124634 * gh-124730 * gh-131755 * gh-133407 * gh-133552 * gh-133841 * gh-133902 * gh-133903 * gh-134640 * gh-134731 * gh-135644 * gh-135654 * gh-137247 * gh-137263 * gh-143758 <!-- /gh-linked-prs -->