Duc
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
Copyright
Duc is an open source project by Most Wanted.
Metadata
Release files for duc 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| duc-1.2.zip | 5.6 kB | Without provenance | Details |
Release files / duc-1.2.zip
| Download URL | duc-1.2.zip |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d3393ca4ad677316099d3714e31663236a317fb2999f6871ec936d0569df203
|
|
BLAKE2b-256 checksum How to use checksums |
80524215aa683c0d4746f2dbf9d3aabe38d5e2216da1db5affca863374099033
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for duc 1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.