Skip to main content

Lightweight Python library for data pipelines

Project description

Litepipe

Lightweight Python module for building modules using syntax similar to Apache Beam.

Pipelines can be created using two classes provided in this package - Pipeline and Transform.

A Pipeline is a one or more Transforms which are essentially functions cast as a Transform class so that they can be easily chained together.

Once a Pipeline is defined, inputs can be passed through using the run functionality. The output of the final step in the pipeline is returned from the run function.

As mentioned above Transform is basically a wrapper class for a function with an overloaded __rshift__ method. This allows Transforms to be chained together using a syntax like

transform_one >> transform_two

This package was born from my curiosity to how packages like Apache Beam and Apache Airflow use the greater than operator to chain functions.

Installation Instructions

pip install litepipe

Example Pipeline

Creating Transforms

Transforms can be easily created using multiple syntax

By first defining a function and passing it as a parameter to the Transform class

def add_two(x: int):
  return x + 2

add_two_transfrom = Transform(add_two)

By passing a lambda function as a parameter

add_transform = Transform(lambda x: x + 2)

Wrapping the function with a decorator function that can be imported from the Transform module

@t
def print_and_divide(input, divider=4):
    print(f"Input: {input} will be divided by {divider}")
    return input / divider

Example Pipeline

add_transform = Transform(lambda x: x + 2)
hello_int = Transform(lambda x: f'Hello, {x}')

pipeline = Pipeline(add_transform >> hello_int)

result = pipeline.run(5)
# output - 'Hello, 7'

Project details


Download files

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

Source Distribution

litepipe-1.0.0a6.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

litepipe-1.0.0a6-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file litepipe-1.0.0a6.tar.gz.

File metadata

  • Download URL: litepipe-1.0.0a6.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for litepipe-1.0.0a6.tar.gz
Algorithm Hash digest
SHA256 14c07e4b023511a07356bbdd7823187381c6b0ec9d36f29276b2a2bd6bb22594
MD5 53efe48cac70fe75e50f606e37eadeb7
BLAKE2b-256 2359a2b2a870d373cd907423f8e58a484854af99ddf667181f3472dbd7337ec8

See more details on using hashes here.

File details

Details for the file litepipe-1.0.0a6-py3-none-any.whl.

File metadata

  • Download URL: litepipe-1.0.0a6-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for litepipe-1.0.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 36c3f30221af7e5cb4ce6540c43eddb954c06235413685e182557d43214ef3b7
MD5 b96e77ea8fe8df5bf65c6ee8ce42901a
BLAKE2b-256 04ab426d5a40ac520dfdb035e6217ffff2da13598782d548628c6a3b04876c64

See more details on using hashes here.

Supported by

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