A simple schema builder for value parsing and validation
Project description
PyYep
PyYep is a python schema builder for value parsing and validation. Define a schema, transform a value to match and validate the inputs with existing validator or custom functions.
PyYep is heavily inspired by Yup
Install
pip install PyYep
Usage
You define and create schema objects with its inputs and validation methods. Then use the verify method to check the schema. A ValidationError will be raised if some input value does not match the validation.
from PyYep import Schema, InputItem, ValidationError
schema = Schema([
InputItem('name', input_object, 'path-to-input_object-value-property-or-method').string().email(),
InputItem('name', input_object, 'path-to-input_object-value-property-or-method').number().min(10).max(100),
], abort_early=False)
// check validity
try:
result = schema.validate()
# handle result
except ValidationError:
# handle fail
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
PyYep-1.1.0.tar.gz
(5.4 kB
view hashes)
Built Distribution
PyYep-1.1.0-py3-none-any.whl
(5.3 kB
view hashes)