Releases: connor-makowski/type_enforced
2.1.0
What's Changed
-
Modify base type checking to include subclasses by default
-
Add support for typing.Any
-
Add back support for WithSubclasses
-
Modify Tests accordingly
-
2.1.0: Add support for typing.Any and check subclasses by default by @connor-makowski in #56
Full Changelog: 2.0.0...2.1.0
2.0.0
What's Changed
The main changes in version 2.0.0 revolve around migrating towards the standard python typing hint process and away from the original type_enfoced type hints (as type enforced was originally created before the |
operator was added to python).
- Support for python3.10 has been dropped.
- List based union types are no longer supported.
- For example
[int, float]
is no longer a supported type hint. - Use
int|float
ortyping.Union[int, float]
instead.
- For example
- Dict types now require two types to be specified.
- The first type is the key type and the second type is the value type.
- For example,
dict[str, int|float]
ordict[int, float]
are valid types.
- Tuple types now allow for
N
types to be specified.- Each item refers to the positional type of each item in the tuple.
- Support for elipsis (
...
) is supported if you only specify two types and the second is the ellipsis type.- For example,
tuple[int, ...]
ortuple[int|str, ...]
are valid types.
- For example,
- Note: Unions between two tuples are not supported.
- For example,
tuple[int, str] | tuple[str, int]
will not work.
- For example,
- Constraints and Literals can now be stacked with unions.
- For example,
int | Constraint(ge=0) | Constraint(le=5)
will require any passed values to be integers that are greater than or equal to0
and less than or equal to5
. - For example,
Literal['a', 'b'] | Literal[1, 2]
will require any passed values that are equal (==
) to'a'
,'b'
,1
or2
.
- For example,
- Literals now evaluate during the same time as type checking and operate as OR checks.
- For example,
int | Literal['a', 'b']
will validate that the type is an int or the value is equal to'a'
or'b'
.
- For example,
- Constraints are still are evaluated after type checking and operate independently of the type checking.
- 2.0.0 by @connor-makowski in #55
Full Changelog: 1.10.2...2.0.0
1.10.2
What's Changed
- Update README.md by @mjmccaffrey in #51
- Script updates by @connor-makowski in #52
- Handle immutable by @connor-makowski in #53
New Contributors
- @mjmccaffrey made their first contribution in #51
Full Changelog: 1.10.1...1.10.2
1.10.1
Full Changelog: 1.10.0...1.10.1
1.10.0
Full Changelog: 1.9.0...1.10.0
- Drop support for python3.9
- Fix bugs related to scenarios where
from __future__ import annotations
caused issues. - Streamline the way annotations / type hints are fetched and stored under the hood for better consistency across major versions.
1.9.0
What's Changed
- 1.9.0: Add support for python 3.14 and future annotations by @connor-makowski in #48
Features Include:
- Support for Python 3.14
- Support for from future import annotations
- Updates to python version testing process (dockerized)
- Renamed scripts
Full Changelog: 1.8.1...1.9.0
1.8.1
- Streamline get_defaults
Full Changelog: 1.8.0...1.8.1
1.8.0
Fix arg bugs when args were given defaults, but then *args were provided followed by kwargs with defaults.
1.7.0
1.7.0