Runtime validation in type annotations
Summary
The article demonstrates runtime validation in Python by leveraging typing.Annotated metadata and typing.get_type_hints to apply validators to dataclass fields. It provides concrete patterns, including a Number validator class, exception groups for aggregating errors, and an exploration of closures as an alternative to callable metadata. Practical tips on immutability and post-init validation are included, along with several full examples.