Skip to main content

Annotate your Python dict

Project description

anodict: annotated dict

Pyversions

Convert a dict to an annotated object.

Usage

Installation

pip install anodict

Example

import anodict


class Person:
    name: str
    age: int

person = anodict.dict_to_class({
    "name": "bob",
    "age": 23
}, Person)

print("type:", type(person))
print("name:", person.name)
print("age:", person.age)

will give:

type: <class '__main__.Person'>
name: bob
age: 23

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

anodict-0.0.2.tar.gz (3.1 kB view hashes)

Uploaded source

Built Distribution

anodict-0.0.2-py3-none-any.whl (3.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page