Skip to main content

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


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.1.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

strictus-1.0.1-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page