Skip to content
This repository has been archived by the owner. It is now read-only.
Container for dictionary-like validated data structures
Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
requirements
tests
tg_option_container
.coveragerc
.gitignore
.isort.cfg
.travis.yml
LICENSE.md
MANIFEST.in
Makefile
README.md
pytest.ini
requirements.txt
setup.cfg
setup.py
tox.ini

README.md

tg-option-container

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.

You can’t perform that action at this time.