Skip to content

Why don't we use dataclasses.dataclass or pydantic to define pythonic datamodels, instead of the custom Serializable ABC? #28

@kwsp

Description

@kwsp

Why don't we use dataclasses.dataclass or pydantic to define pythonic datamodels, instead of the custom Serializable ABC?

  1. Serializable's definition implies that it's an abstract base class, yet it's not exactly "abstract" and provides the actual implementation of helper methods serialize and deserialize, which makes it a "mix-in" class rather than an ABC.
  2. From reading the code, it seems like the functionalities provided by Serializable can be accomplished by the standard library dataclass or (if desiring something more powerful), the pydantic classes.
  3. Using the standard library or pydantic would relieve this library from maintaining the serialization and typing infrastructure, and they are also much more battle tested.

Just some thoughts and rambling since the Serializable mechanism doesn't seem to be very robust as I'm getting bugs from k-wave-python
waltsims/k-wave-python#36

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions