Skip to main content

Container for dictionary-like validated data structures

Project description

Build Status Coverage Status PyPI Status

Container for dictionary-like validated data structures

Documentation is available on Read the Docs: http://tg-option-container.readthedocs.io

Getting started

Install tg-option-container:

pip install tg-option-container

Then use it in your project:

from tg_option_container import Option, OptionContainer


class Character(OptionContainer):
    props = [
        Option.string('name', None),
        Option.string('gender', None, choices=('M', 'N')),
    ]


john = Character(name='John Smith', gender='M')

# This will raise: tg_option_container.types.InvalidOption: Invalid choice x for option `gender`, choices are ('M', 'N').
mary = Character(name='Mary Smith', gender='x')

Development

You can run the tests by running tox in the top-level of the project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tg-option-container, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size tg_option_container-0.4.0-py2.py3-none-any.whl (10.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size tg-option-container-0.4.0.tar.gz (9.2 kB) File type Source Python version None Upload date Hashes View

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