typing_extensions
typing_extensions copied to clipboard
Backported and experimental type hints for Python
See https://github.com/python/cpython/issues/109562. `types.CapsuleType` was added in https://github.com/python/cpython/pull/109600 but cannot be used before 3.13.
I'm not sure if you're aiming for exact compatibility among python versions for all of the functions you support or not. But due to https://github.com/python/cpython/issues/90353, `get_type_hints` with `include_extras=True` has inconsistent...
I was working on serialization / deserialization logic for the new PEP 646 in [mashumaro](https://github.com/Fatal1ty/mashumaro), but unfortunately the following example from https://peps.python.org/pep-0646/#type-arguments-can-be-variadic doesn't work as expected on older python versions...
There is a problem with typing_extensions that doesn't happen with typing. Running the program with python3.11 works, but with python3.10 with typing_extensions throws: ``` Traceback (most recent call last): File...
The following code should work without a runtime exception. ```python from typing import Any, Callable from typing_extensions import ParamSpec, Concatenate P = ParamSpec("P") MyAlias = Callable[Concatenate[int, P], Any] x: MyAlias[...]...
https://github.com/python/cpython/pull/30969 allowed and documented this behaviour for 3.11. This seemingly can't be supported for
I create generic class with specifying `__init__` arguments through ParamSpec: ``` from typing import Generic from typing_extensions import ParamSpec P = ParamSpec('P') class CLS(Generic[P]): def __init__(self, *args: P.args, **kwargs: P.kwargs):...
This list, [formerly included in the readme](https://github.com/python/typing_extensions/blob/962936a9e4583d4d424ff85745e9aeb6cf4460ee/README.md), is extremely useful. Especially when developing on a later version than the minimum supported by the code. Would you consider adding it back...
python: 3.8.5 ```python import sys from typing import TypeVar def run(): sys.modules.pop("typing_extensions", None) from typing_extensions import ParamSpec return isinstance(ParamSpec("P"), TypeVar) def trace_call(frame, event, arg): return trace_call if __name__ == "__main__":...
I believe the following should be a passing test suite for multiple inheritance and ReadOnly: ```python from typing_extensions import TypedDict, Required, NotRequired, ReadOnly class A(TypedDict): k: ReadOnly[Required[int]] class B(TypedDict): k:...