The class statement takes keyword arguments for various features. For example, the __init_subclass__ function receives keyword arguments passed at the class declaration:
class A(object):
def __init_subclass__(cls, **kwargs):
print(f'{kwargs=}')
class B(A, my_arg=5):
pass
kwargs={'my_arg': 5}
However, doing so prevents dynamic class creation: The type function does not seem to take the class keyword arguments. A factory function does, but may conflict with __init_subclass__ or similar when the factory must modify the class.
I would like to use the type() built-in function in its 3-arguments version to dynamically create a class. However, there seems to be no documented way to pass keyword arguments (like my_arg in the previous example).
What would be the recommended way of doing it ?