Add type hints for models
Closed this issue · 0 comments
Is your feature request related to a problem? Please describe.
Type hints make it significantly easier for clients to use the SDK.
Describe the solution you'd like
Type hints would be great to see for the models
module especially, since this part of the codebase is external-facing.
This makes it significantly easier for developers to use the library because they will clearly know what constitutes expected values for class attributes and function params.
Additionally, many IDEs support on-hover definitions of classes which include the attributes' types when they're defined, again making developers' lives easier.
Describe alternatives you've considered
An interim solution would be to provide docstrings for every externally-used model class, containing the type hints, e.g.
def foo(a, n, *, some_opt=False):
"""
A foo that bars.
Arguments:
a {str} - An 'a' string.
n {int} - The number of times to print 'a'.
Keyword Arguments:
some_opt {bool} - Whether to do some option or not.
"""
...
This isn't verifiable via mypy
so is a worse solution, but at least would give developers a better idea of the expected types.