Skip to main content

Certifiers for everyone!

Project description



.. image::

.. image::
:alt: PyPi version

.. image::
:alt: CI Status

.. image::
:alt: Coverage Status

.. image::

.. image::

.. image::

.. image::

.. image::

.. image::
:alt: Documentation Status

.. image::
:alt: Updates

Certifiable is a powerful runtime parameter validation library for python.


Examples of all features can be found here: :ref:`usage`.

Core types

It can validate the following *core* types

* Text
* Unicode
* String
* Bytes
* Bool
* Int
* Long
* Number
* Decimal
* Float
* Enum
* Enum value
* Timestamp
* Date
* Time
* Object

Complex types

There are more `complex` or compound types into which you can pass `other` certifiers:

* List
* Tuple
* Set
* Iterable
* Dict
* Json
* Html
* Email


There are logical operators to combine certifiers:

* ANY (certify_only_one)
* AND (certify_all)
* ALL (certify_all)
* NAND (certify_none)
* XOR (certify_only_one)

Custom Certifier

Use the `make_certifier` decorator and (optionally) bake-in some args and kwargs (any return value
from a certifier is ignored) to create your own certifier (first arg must be the value to certify):

>>> @make_certifier
... def my_certifier(value, *baked_args, **baked_kwargs):
... print value
... print baked_args
... print baked_kwargs
... baked_kwargs['data'].append('green')
... if len(baked_kwargs['data'])==2:
... raise MyError('damn!')

>>> args_to_bake = ('eggs', 'ham')
>>> kwargs_to_bake = dict(spam='lots', data=[])
>>> certifier = my_certifier(*args_to_bake, **kwargs_to_bake)

certifier can now be used as an argument to other certifiers.

>>> certify_list(
... [1,'a'],
... certifier=certifiers,
... min_len=2,
... max_len=5,
... required=True,
... )
('eggs', 'ham')
{'spam': 'lots', data: []}
('eggs', 'ham')
{'spam': 'lots', data: ['green']}
Traceback (most recent call last):
MyError: damn!


* Free software: MIT license
* Documentation:


Project details

Download files

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

Files for certifiable, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size certifiable-0.1-py2.py3-none-any.whl (14.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size certifiable-0.1.tar.gz (236.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page