Python Schema Library
Project description
Ciri helps you build schema definitions for your application; giving you a foundation to perform validation, serialization and encoding.
Features
Python 3/2 support
Serialize data to basic Python types
Deserialize data back to schema objects
Schema encoding
Polymorphic schemas
Composable Fields
Controllable error handling
Pre/post processors available on fields
Simple API
Install
$ pip install ciri
Documentation
Documentation can be found at http://ciri.hellouser.net/ .
Example
import datetime
from ciri import fields, Schema, ValidationError
class Actor(Schema):
first_name = fields.String()
last_name = fields.String()
class Movie(Schema):
title = fields.String()
released = fields.Date()
cast = fields.List(Actor())
movie = Movie()
output = movie.serialize({'title': 'Good Will Hunting',
'released': datetime.date(1998, 1, 9),
'cast': [
{'first_name': 'Matt', 'last_name': 'Damon'},
{'first_name': 'Ben', 'last_name': 'Affleck'},
{'first_name': 'Robin', 'last_name': 'Williams'}
]})
# output:
# {'cast': [{'last_name': 'Damon', 'first_name': 'Matt'},
# {'last_name': 'Affleck', 'first_name': 'Ben'},
# {'last_name': 'Williams', 'first_name': 'Robin'}],
# 'released': '1998-01-09',
# 'title': 'Good Will Hunting'}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ciri-0.6.0.tar.gz
(16.8 kB
view details)
Built Distribution
ciri-0.6.0-py2.py3-none-any.whl
(19.6 kB
view details)
File details
Details for the file ciri-0.6.0.tar.gz
.
File metadata
- Download URL: ciri-0.6.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 633fa4e981def24352b679be9d3f750549264649aaa290d9aaca044ac07e86fc |
|
MD5 | 8fbe9d227dd107cc168d0ffe9d679054 |
|
BLAKE2b-256 | fbdb10ee86ae58d2c87ac91025449e3fd402718fda2177be3494c012dffee569 |
File details
Details for the file ciri-0.6.0-py2.py3-none-any.whl
.
File metadata
- Download URL: ciri-0.6.0-py2.py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b73d908973b6a2a765ed0e29079be6cc643a85ef21c2db717c5e4480cf52dcb |
|
MD5 | aafa345c97546e34b5713780202103b0 |
|
BLAKE2b-256 | 7e8c75ac22c7e58f9a4b6d7d765633a3dde390732fb184bdab9164acb6ea03fb |