Skip to main content

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.

Metadata

Release files for kuvalda 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kuvalda 0.1.0
File Size Uploaded
kuvalda-0.1.0.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kuvalda 0.1.0
File Interpreter ABI Platform
kuvalda-0.1.0.macosx-10.12-x86_64.tar.gz Details

Total release size: 7.5 kB

Release files / kuvalda-0.1.0.tar.gz

Download URL kuvalda-0.1.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8a88eb3bfd9ac07754556dca795631220affa1d8f4058fe9f36f39a517bf4b5b
BLAKE2b-256 checksum
How to use checksums
7dbdcda7d86b4cc4ad7d9fc6b235eaa25a948cb325b04f913413457ba80a470b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / kuvalda-0.1.0.macosx-10.12-x86_64.tar.gz

Download URL kuvalda-0.1.0.macosx-10.12-x86_64.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fa6510f0da6c5b7c1853ea685a9117db78de221b6865cf45ebee09ce9a464166
BLAKE2b-256 checksum
How to use checksums
02274562b150d3b085b75b920e8491ad3cf24cd241cbdb3acfd549901cd35c8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page