This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Damn Simple Validation Kit.

Project Description

About

Validate dict-like object against schema, using just callables.

Features

  • Allows validating and sanitizing dicts using any callables
  • Provides several useful helpers
  • Easy to use – no class-based boilerplate!

API

validate function takes any mapping as data and another mapping as scheme and check data against scheme. It returns list of errors.

sanitize function takes any mapping as data and another mapping as scheme and converts data according to schema definition.

For more info – see tests.

Examples

Several schemes:

schema = {
    'key1': str,
    'key2': int,
    'key3': int,
}

schema1 = {
    'key1': kuvalda.list_of(int),
    'key2': kuvalda.list_of(kuvalda.list_of(int))
}

schema2 = {
   'section1': {
       'key1': str,
       'key2': int
    },
    'section2': kuvalda.mapping(str, int),
    'key1': kuvalda.kind_of(bool)
}

schema3 = {
    'key1': int,
    'key2': kuvalda.default('oh, my'),
    'key3': kuvalda.optional(int),
    'key4': kuvalda.optional(kuvalda.list_of(int)),
    'key5': kuvalda.compose(kuvalda.default(42), int)
}

Install

~/yourvirtualenv/python setup.py install

pip install kuvalda

License

The MIT License, in LICENSE file.

Release History

Release History

This version
History Node

0.1.0

History Node

0.0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
kuvalda-0.1.0.macosx-10.12-x86_64.tar.gz (4.7 kB) Copy SHA256 Checksum SHA256 any Dumb Binary Dec 11, 2016
kuvalda-0.1.0.tar.gz (2.8 kB) Copy SHA256 Checksum SHA256 Source Dec 11, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting