Historically in Python, adding explicit typing for kwargs was not directly supported; however, Python 3.12 added that ability. In this post, we’ll go over methods for adding types to the kwargs argument. Adding type annotations to kwargs Python 3.12 released a new method for explicitly typing kwargs: using a TypedDict + Unpack. 1from typing import NotRequired, TypedDict, Unpack 2 3 4class Parameters(TypedDict): 5 foo: int 6 bar: str 7 baz: NotRequired[str] 8 9 10def some_function(**kwargs: ...