odmantic
odmantic copied to clipboard
Incompatible With Type Hinting Generics In Standard Collections
from odmantic import Model
class User(Model):
scopes: list[str]
print(User(scopes=[]))
Caused errors like this:
Traceback (most recent call last):
File "C:\xxxx\main.py", line 3, in <module>
class User(Model):
File "C:\xxxx\lib\site-packages\odmantic\model.py", line 381, in __new__
mcs.__validate_cls_namespace__(name, namespace)
File "C:\xxxx\lib\site-packages\odmantic\model.py", line 219, in __validate_cls_namespace__
substituted_type = validate_type(field_type)
File "C:\xxxx\lib\site-packages\odmantic\model.py", line 176, in validate_type
setattr(type_, "__args__", new_arg_types)
AttributeError: readonly attribute
This is a blocking bug for me--I cannot use odmantic until it's resolved. I guess I've got to use Beanie instead.