https://github.com/oelin/valory
Validated dataclasses for Python.
https://github.com/oelin/valory
dataclasses python
Last synced: 3 months ago
JSON representation
Validated dataclasses for Python.
- Host: GitHub
- URL: https://github.com/oelin/valory
- Owner: oelin
- License: mit
- Created: 2023-02-06T14:06:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-31T10:13:24.000Z (over 1 year ago)
- Last Synced: 2023-12-31T11:19:53.521Z (over 1 year ago)
- Topics: dataclasses, python
- Language: Python
- Homepage:
- Size: 65.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Valory
Validated dataclasses for Python.
Installation
------------```sh
pip install git+https://github.com/oelin/valory
```Usage
-----```python
from valory import dataclass@dataclass
class User:
username: str
password: strdef validate(self) -> None:
assert isinstance(self.username, str)
assert isinstance(self.password, str)
``````python
user = User('Alice', 1234) # Throws an exception.
```