Validated dataclasses for Python.
pip install git+https://github.com/oelin/valory
from valory import dataclass
@dataclass
class User:
username: str
password: str
def validate(self) -> None:
assert isinstance(self.username, str)
assert isinstance(self.password, str)
user = User('Alice', 1234) # Throws an exception.