Skip to main content

Module for validating and transforming data

Project description

Duc (transducer) is a data transformation tool for Python.

>>> d = Duc({'name': {'validator': {'type': 'string'}, 'transform': {'name': 'number_name', 'type': 'integer'}})
>>> v.validate({'name': '518'})
>>> v.transform()
>>> v.result
{'number_name': 518}


Sometimes your application receives data from one place and then (after some transformation) sends it to other place. Often you cannot change the format of data you receive because source dictates its own requirements. But with Duc you can validate input (using Cerberus) and make transformations on it (using similar syntax). Particular example is when you get data from a client and save it to database. You want to validate it or leave it as-is (if you trust client) but select specific fields or transform data to other format is required. Slightly like forms in web-application. It was tested under Python 3.4. Compatibility with other versions is not guaranteed.


Complete documentation is missed by you can check for code snippets and usage illustration


Duc is on PyPI so all you need is:

$ pip install duc

Also you can install it from Github directly (to use latest version)

$ pip install git+


Just run (with Pytest):

$ py.test tests

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


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 (5.6 kB) Copy SHA256 hash SHA256 Source None Jun 4, 2015

Supported by

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