Strictus (a rewrite of Strictus Dictus)
Project description
strictus
A much tested rewrite of strictus-dictus (github repo) which does not extend dict
.
Installation
pip install strictus
Usage
from typing import List
from strictus.core import strictus, strictus_field
class Item(strictus):
id: str
name: str
class ItemList(strictus):
items: List[Item] = strictus_field(default_factory=list)
item_list = ItemList({"items": [{"id": 1, "name": "first"}]})
print(item_list.items[0].name) # prints "first"
print(item_list.to_dict()) # prints "{'items': [{'id': '1', 'name': 'first'}]}"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
strictus-1.0.2.tar.gz
(8.6 kB
view hashes)