Skip to main content

convtools is a python library to declaratively define fast conversions from python objects to python objects, including processing collections and doing complex aggregations.

Project description

convtools is a python library to declaratively define fast conversions from python objects to python objects, including processing collections and doing complex aggregations.

https://img.shields.io/pypi/pyversions/convtools.svg https://img.shields.io/github/license/itechart-almakov/convtools.svg https://codecov.io/gh/itechart-almakov/convtools/branch/master/graph/badge.svg Tests Status Documentation Status https://img.shields.io/github/tag/itechart-almakov/convtools.svg https://badge.fury.io/py/convtools.svg Downloads

Description

The speed of convtools comes from the approach of generating code & compiling conversion functions, which don’t have any generic code like superfluous loops, ifs, etc.

So you can follow the DRY principle by storing and reusing the code on the python expression level, but at the same time be able to run the gen_converter and get the compiled code which doesn’t care about being DRY and is generated to be highly specialized for the specific need.

Thanks to pipes & labels it’s possible to define multiple pipelines of data processing, including branching and merging of them.

Conversions are not limited to simple data transformations, there are GroupBy & Aggregate conversions with many useful reducers:

  • from common Sum, Max

  • and less widely supported First/Last, Array/ArrayDistinct

  • to DictSum-like ones (for nested aggregation) and MaxRow/MinRow (for finding an object with max/min value and further processing)

Every conversion:
  • contains the information of how to transform an input

  • can be piped into another conversion (same as wrapping)

  • can be labeled to be reused further in the conversions chain

  • has a method gen_converter returning a function compiled at runtime

  • despite being compiled at runtime, is debuggable with pdb due to linecache populating.

Installation:

pip install convtools

Documentation

convtools on Read the Docs

Project details


Release history Release notifications | RSS feed

This version

0.3.0

Download files

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

Source Distribution

convtools-0.3.0.tar.gz (54.9 kB view details)

Uploaded Source

File details

Details for the file convtools-0.3.0.tar.gz.

File metadata

  • Download URL: convtools-0.3.0.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for convtools-0.3.0.tar.gz
Algorithm Hash digest
SHA256 221463458a47a9d37eb995b90afee22e209585aa58353c1b5ced7c869c5914e2
MD5 0b20372bf60b20d7d20af6aeaeac849b
BLAKE2b-256 da0e5506837b320803baab9d59c77a1888123c64348b4fec4f4e96ac93a6d1e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page