-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
LocalStack uses moto as a backend for many emulated services. For these services, we implement the persistence features by serializing and deserializing the various BackendDicts.
Our new implementation of persistence heavily relies on type annotations. For it to properly function, it requires having annotated instance variables for all the Python objects ending up in the BackendDicts.
moto is very rigorous with annotated assignments for BackendDicts. However, the assignments are in the constructor and are not specified as instance variables (e.g., look here for an example).
The same happens for all the other BaseModel classes (e.g., here). In these cases, the assignments are not even annotated.
I would love to propose a small refactoring of the moto models to widely adopt instance variable annotations. This work is clearly beneficial to LocalStack users, but is also in line with modern Python coding standards (e.g., PEP 526). I will open a PR to demonstrate what a refactoring for a service could look like.
I am open to any feedback or comment on these type of changes :)