Skip to content

Releases: connor-makowski/type_enforced

2.1.0

04 Jun 14:57
1180ad8
Compare
Choose a tag to compare

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

30 May 20:48
f86fa07
Compare
Choose a tag to compare

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 or typing.Union[int, float] instead.
  • 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] or dict[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, ...] or tuple[int|str, ...] are valid types.
    • Note: Unions between two tuples are not supported.
      • For example, tuple[int, str] | tuple[str, int] will not work.
  • 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 to 0 and less than or equal to 5.
    • For example, Literal['a', 'b'] | Literal[1, 2] will require any passed values that are equal (==) to 'a', 'b', 1 or 2.
  • 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'.
  • Constraints are still are evaluated after type checking and operate independently of the type checking.

Full Changelog: 1.10.2...2.0.0

1.10.2

05 Mar 20:08
bf12bdf
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 1.10.1...1.10.2

1.10.1

31 Jan 17:52
Compare
Choose a tag to compare

Full Changelog: 1.10.0...1.10.1

1.10.0

30 Jan 16:44
Compare
Choose a tag to compare

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

29 Jan 14:59
743b730
Compare
Choose a tag to compare

What's Changed

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

03 Dec 18:59
Compare
Choose a tag to compare

1.8.0

15 Nov 21:57
Compare
Choose a tag to compare

Fix arg bugs when args were given defaults, but then *args were provided followed by kwargs with defaults.

1.7.0

15 Nov 21:56
Compare
Choose a tag to compare
1.7.0

1.6.0

11 Nov 19:41
Compare
Choose a tag to compare

1.6.0: Automatically merge nested iterables to fix some issues discovered in #41