Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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'})
True
>>> v.transform()
True
>>> v.result
{'number_name': 518}

About

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.

Documentation

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

Installation

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+https://github.com/bmwant21/duc.git

Testing

Just run (with Pytest):

$ py.test tests
Release History

Release History

This version
History Node

1.2

History Node

1.1

History Node

1.0

History Node

0.9

History Node

0.8

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
duc-1.2.zip (5.6 kB) Copy SHA256 Checksum SHA256 Source Jun 4, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting