I need to automatically check and convert function parameters based on their type annotations. Here's an example of what I'm trying to achieve: from typing_extensions import TypeAlias, Any, Annotated, Callable DateLike: TypeAlias = Any class DateValidator: def __call__(self, value): """parse DateLike value, and if you want, convert it to str/datetime.date/...""" def param_check(some_func: Callable) -> Callable: pass @param_check def func(param1: Annotated[DateLike, DateValidator()]): pass In this example, the param_check decorator should automatically validate and convert the param1 argument based on the DateValidator provided in the Annotated type. I've looked into Pydantic, but it seems more suited for data validation in models rather than function parameters. Questions: Are there any existing libraries that can automatically validate and convert function parameters based on type annotations? If not, what would be the best approach to implement such a decorator? Continue reading...