Skip to content

Changelog

2.2.3 (2024-05-31)

TypeDescriptionPRIssuesAuthor
Fix Fix star import from `typeapi`39@NiklasRosenstein
Tests Add a unit test for the expected behaviour when inheriting from an unparameterized generic base class40@NiklasRosenstein

2.2.2 (2024-05-31)

TypeDescriptionPRIssuesAuthor
Feature Support `typing.NewType` in `typeapi.ClassTypeHint`38@NiklasRosenstein

2.2.1 (2024-03-18)

TypeDescriptionPRIssuesAuthor
Fix Export `TypedDictProtocol` again in `typeapi` module (regression introduced in 2.2.0)@NiklasRosenstein
Fix Export `ClassVarTypeHint` and `TypeAliasTypeHint` in `typeapi`@NiklasRosenstein

2.2.0 (2024-03-18)

TypeDescriptionPRIssuesAuthor
Fix Fixed an error when evaluating `FakeHint` objects when an argument to a type-hint such as `Annotated` was the constant value `True`, `False`, `None`, `0` or `1`.@NiklasRosenstein
Breaking change Drop support for Python 3.6 and 3.7@NiklasRosenstein

2.1.1 (2023-07-10)

TypeDescriptionPRIssuesAuthor
Fix Fix `ClassVarTypeHint._copy_with_args()`@NiklasRosenstein

2.1.0 (2023-07-03)

TypeDescriptionPRIssuesAuthor
Feature Support `TypeAlias` and `ClassVar` type hints@NiklasRosenstein

2.0.1 (2023-06-21)

TypeDescriptionPRIssuesAuthor
Fix `ClassTypeHint.recurse_bases()` now parameterizes type parameters.@NiklasRosenstein

2.0.0 (2023-06-12)

TypeDescriptionPRIssuesAuthor
Breaking change A plain `tuple` type is no longer represented by a `TupleTypeHint`, but instead by a `ClassTypeHint`.@NiklasRosenstein

1.5.1 (2023-06-11)

TypeDescriptionPRIssuesAuthor
Fix `ClassTypeHint.bases` now falls back to the types actual base classes if it is not a generic type@NiklasRosenstein
Feature add `ClassTypeHint.recurse_bases()`@NiklasRosenstein

1.5.0 (2023-06-11)

TypeDescriptionPRIssuesAuthor
Improvement `TupleTypeHint` is now a subclass of `ClassTypeHint`; `ClassTypeHint.bases` no longer returns none@NiklasRosenstein

1.4.3 (2023-05-13)

TypeDescriptionPRIssuesAuthor
Improvement Add `TupleTypeHint.type`@NiklasRosenstein

1.4.2 (2023-04-12)

TypeDescriptionPRIssuesAuthor
Fix Fixed evaluating forward references to members on the class level. Note that the `TypeHint(source)` parameter must be set accordingly to the class where the forward reference should be resolved in.@NiklasRosenstein

1.4.1 (2023-03-23)

TypeDescriptionPRIssuesAuthor
Docs Clarify that future type hint evaluation for Union-style syntax continues to return a `typing.Union` instead of `types.UnionType` even in Python 3.10+.@NiklasRosenstein
Fix Fix taking into account an objects origin module for the global namespace when resolving forward references.@NiklasRosenstein

1.4.0 (2023-03-02)

TypeDescriptionPRIssuesAuthor
Fix provide experimental support for evaluating future type hints that perform a function call; sometimes this is used in the metadata for `Anntoated[...]` hints@NiklasRosenstein
Fix Support evaluation of future type hints in `typeapi.get_annotations()` and add new `typeapi.get_annotations(eval_str)` parameter. We backport a modified version of `inspect.get_annotations()` from Python 3.11 for this.@NiklasRosenstein

1.3.5 (2023-01-10)

TypeDescriptionPRIssuesAuthor
Fix fix type hint fake evaluation when an actual typing.Optional is encountered@NiklasRosenstein

1.3.4 (2022-12-10)

TypeDescriptionPRIssuesAuthor
Fix fix passing `TypeHint(source)` argument which before would not be accepted@NiklasRosenstein

1.3.3 (2022-12-05)

TypeDescriptionPRIssuesAuthor
Feature add `TypeHint.source`, `TypeHint.get_context()` and make `TypeHint.evaluate(context)` argument optional@NiklasRosenstein
Fix Support `types.UnionType` in Python 3.10+7@NiklasRosenstein

1.3.2 (2022-11-11)

TypeDescriptionPRIssuesAuthor
Fix fix evaluating type hints that are attributes of other objects (`FakeHint` did not implement `__getattr__()`)@NiklasRosenstein

1.3.1 (2022-11-11)

TypeDescriptionPRIssuesAuthor
Fix fix evaluation of PEP604 optional type hints (e.g. `int | None`)@NiklasRosenstein

1.3.0 (2022-11-11)

TypeDescriptionPRIssuesAuthor
Feature support future typing syntax (such as `list[int]` and `int | None`) when evaluating forward references.5@NiklasRosenstein

1.2.1 (2022-11-10)

TypeDescriptionPRIssuesAuthor
Fix expose TupleTypeHint@NiklasRosenstein

1.2.0 (2022-11-10)

TypeDescriptionPRIssuesAuthor
Feature add `TupleTypeHint` support@NiklasRosenstein

1.1.0 (2022-11-10)

TypeDescriptionPRIssuesAuthor
Improvement support all common special generic aliases instead of just List and Dict when using TypeHint.parameterize() or TypeHint.evaluate()@NiklasRosenstein
Fix Mark typeapi as requiring at least Python 3.6.3 or higher, this is because Forward references on class members are not correctly resolved by typing.get_type_hints() in 3.6.2 and before (see https://github.com/python/cpython/commit/1658ec07577ef9696cea76fcf7fac2da18403ec5#diff-ddb987fca5f5df0c9a2f5521ed687919d70bb3d64eaeb8021f98833a2a716887R1501-R1504)@NiklasRosenstein
Improvement Improve error message when `TypeHint._copy_with_args()` fails due to a TypeError (eg if the type is not actually subscriptable) to include the type in question.@NiklasRosenstein

1.0.1 (2022-11-06)

TypeDescriptionPRIssuesAuthor
Fix add `TypeHint.__iter__()`@NiklasRosenstein

1.0.0 (2022-11-06)

TypeDescriptionPRIssuesAuthor
Breaking change Full rewrite of `typeapi` with limited support for more exotic type hints but strong support for common runtime type hint needs.@NiklasRosenstein

0.2.2 (2022-08-30)

TypeDescriptionPRIssuesAuthor
Fix fix issue with `typeapi.get_annotations(include_bases=False)` if class has no explicit annotations3@NiklasRosenstein

0.2.1 (2022-06-20)

TypeDescriptionPRIssuesAuthor
Improvement Enable strict type checking in Mypy@NiklasRosenstein

0.2.0 (2022-05-29)

TypeDescriptionPRIssuesAuthor
Improvement Limit types accepted for `typeapi.get_annotations() to modules, types and callables as is also the case in `inspect.get_annotations()` starting with 3.10@NiklasRosenstein

0.1.6 (2022-04-19)

TypeDescriptionPRIssuesAuthor
Feature Add `recursive` argument to `ForwardRef.evaluate()`@NiklasRosenstein
Feature Add `ignore_name_errors` to `eval_types()`@NiklasRosenstein

0.1.5 (2022-03-23)

TypeDescriptionPRIssuesAuthor
Feature add `typeapi.utils.scope()`@NiklasRosenstein

0.1.4 (2022-03-23)

TypeDescriptionPRIssuesAuthor
Feature add `typeapi.utils.unwrap()`@NiklasRosenstein

0.1.3 (2022-03-23)

TypeDescriptionPRIssuesAuthor
Feature add `globalns` and `localns` parameters to `get_annotations()` and `ForwardRef.evaluate()`@NiklasRosenstein
Feature add `typeapi.utils.scoped()` decorator@NiklasRosenstein

0.1.2 (2022-03-22)

TypeDescriptionPRIssuesAuthor
Improvement add `get_annotations(include_bases)` parameter@NiklasRosenstein
Improvement update `ForweardRef.__repr__()`@NiklasRosenstein

0.1.1 (2022-03-17)

TypeDescriptionPRIssuesAuthor
Fix Fix an error caused when using `Type.get_orig_bases()` if the `Type.type` has non-generic bases@NiklasRosenstein
Deprecation Deprecated `get_type_hints()` in favor of new `get_annotations()`@NiklasRosenstein
Fix Fix `get_annotations()` in Python 3.9 and older to have the same behaviour as `inspect.get_annotations()` in that it does not include annotations of a classes' bases@NiklasRosenstein
Feature Add `typeapi.utils.is_typed_dict()` and the `typeapi.utils.TypedDict` protocol@NiklasRosenstein

0.1.0 (2022-03-17)

TypeDescriptionPRIssuesAuthor
Feature Add `Type.get_orig_bases()`@NiklasRosenstein
Feature Add `Type.get_orig_bases_parametrized()`@NiklasRosenstein
Fix Fix `infuse_type_parameters()` to replace sole `typeapi.TypeVar` instead of only occurrences in `typeapi.Type.args`@NiklasRosenstein
Fix Fix `infuse_type_parameters()` to replace sole `typeapi.TypeVar` instead of only occurrences in `typeapi.Type.args`@NiklasRosenstein
Fix Fix `Type.get_parameter_mapping()` return annotation@NiklasRosenstein
Fix Fix `infuse_type_parameters()` to handle plain `typeapi.TypeVar` and not just the like in `typeapi.Type.args`@NiklasRosenstein

0.1.0a5 (2022-03-17)

TypeDescriptionPRIssuesAuthor
Breaking change Change `ForwardRef` and `NewType` to hold the origin `typing` object@NiklasRosenstein
Feature Implement `ForwardRef.evaluate()`@NiklasRosenstein
Feature add `typeapi.eval_types()`@NiklasRosenstein
Feature add `typeapi.infuse_type_parameters()`@NiklasRosenstein

0.1.0a4 (2022-03-17)

TypeDescriptionPRIssuesAuthor
Fix fix `from typeapi import *`@NiklasRosenstein
Improvement export `get_type_hints()` and `type_repr()` in `typeapi` root module@NiklasRosenstein
Improvement `is_generic()` no longer returns true if the type is the actualy `typing.Generic` because only its subclasses of `__parameters__`@NiklasRosenstein
Fix `Type.of()` no longer errors on passing `typing.Generic` and handles it as `Type(typing.Generic, 0, None, None)`@NiklasRosenstein
Feature Add `Type.get_parameter_mapping()`@NiklasRosenstein
Breaking change Type hints are now converted recursively, all recursive API models now store `Hint` objects directly instead of the raw typing argument.@NiklasRosenstein

0.1.0a3 (2022-03-15)

TypeDescriptionPRIssuesAuthor
Breaking change remove `Type.args` field and instead make it a property@NiklasRosenstein
Breaking change Added `Type.info` property@NiklasRosenstein
Feature `deconstruct_type()` now supports concrete types@NiklasRosenstein
Feature export members from `typeapi.api`, `typeapi.parser` and `typeapi.deconstruct`, most notably `typeapi.of()` is not available as an alias for `typeapi.parser.parse_type_hint()`@NiklasRosenstein
Breaking change remove `Hint.source`@NiklasRosenstein
Breaking change remove `typeapi.deconstruct` module, make `typeapi.model.Type` have the fields that `TypeInfo` used to have and move `deconstruct_type()` to `Type.of()`@NiklasRosenstein

0.1.0a2 (2022-03-15)

TypeDescriptionPRIssuesAuthor
Breaking change add `Hint.source` field@NiklasRosenstein