/valory

Validated dataclasses for Python.

Primary LanguagePythonMIT LicenseMIT

Valory

Validated dataclasses for Python.

Installation

pip install git+https://github.com/oelin/valory

Usage

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.