Skip to main content

A simple, fast, extensible python library for data validation.

Project description

# Validr

[![travis-ci](]( [![codecov](](

A simple, fast, extensible python library for data validation.

- Simple and readable schema
- 10X faster than [jsonschema](,
40X faster than [schematics](
- Can validate and serialize any object
- Easy to create custom validators
- Accurate and friendly error messages


- 简洁,易读的 Schema
- 比 [jsonschema]( 快 10 倍,比 [schematics]( 快 40 倍
- 能够校验&序列化任意类型对象
- 易于拓展自定义校验器
- 准确友好的错误提示

## Overview

from validr import T, modelclass, asdict

class Model:
"""Base Model"""

class Person(Model):
name=T.str.maxlen(16).desc('at most 16 chars')
website=T.url.optional.desc('website is optional')

guyskk = Person(name='guyskk', website='')

## Install

Note: Only support python 3.4+

pip install validr

## Document

## Performance

benchmark result in Travis-CI:

voluptuous:default 10000 loops cost 0.368s
schema:default 1000 loops cost 0.318s
json:loads-dumps 100000 loops cost 1.380s
validr:default 100000 loops cost 0.719s
validr:model 100000 loops cost 1.676s
jsonschema:draft3 10000 loops cost 0.822s
jsonschema:draft4 10000 loops cost 0.785s
schematics:default 1000 loops cost 0.792s
voluptuous:default 375
schema:default 43
json:loads-dumps 1000
validr:default 1918
validr:model 823
jsonschema:draft3 168
jsonschema:draft4 176
schematics:default 17

## Develop

Validr is implemented by [Cython]( since v0.14.0, it's 5X
faster than original pure python implemented.


It's better to use [virtualenv]( or
similar tools to create isolated Python environment for develop.

After that, install dependencys:


**build, test and benchmark**:

inv build
inv test
inv benchmark

## License

MIT License

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
validr-1.0.6.tar.gz (176.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page