Skip to main content

Easy way of creating pipelines

Project description

EasyPype - Create a flexible, extensible, potent pipelines

EasyPype allows you to create flexible and extensible pipelines using python. You can setup the sequence of operations you need and sink all data processed easily. Also, you may use the tools provided to create variations of the same pipeline, with minor changes.

Overview

EasyPype will offer you:

  • Easy and flexibe way to define a set of operations and the correct order to execute them.
  • Multiprocessing execution of your operations.
  • Extensible code, so you can add new features easily.

Quick start

First, you must install EasyPype:

pip install easypype

Then, create a new python file and import it:

import easypype as ep

In order to understand how EasyPype will help you, let's take a look at this code snippet:

import easypype as ep

pipe = ep.PipeBuilderConcrete().command(ep.Sum(2)).build()
mySink = ep.ConcreteSink()
mySink.collect([1, 2, 3])
pipe.do(mySink)

Basically, EasyPype uses four modules:

  1. "command", it has the Command class, the generic pipe operation.
  2. "pipe", it holds classes related to pipe logic: Pipe, a command that executes a given list of commands and PipeBuilder, the entity responsible to create a Pipe object.
  3. "sink", it knows the Sink class, a basic data holder.
  4. "log", it gives you a simple configured logger using "logging" from python.

Hence, you can:

  • Load data
mySink = ep.ConcreteSink()
mySink.collect([1, 2, 3])
  • Setup operations
pipe = ep.PipeBuilderConcrete().command(ep.Sum(2)).build()
  • Run pipeline
pipe.do(mySink)

Adding custom commands

By default, EasyPype has a command called Sum that iterates an iterable object and increases each register by some amount. However, you can easily define your own command:

import easypype as ep

class Multiplier(ep.Command):

    def __init__(self, amount):
        self.amount = amount

    def multiply(self, sink: ep.Sink):
        return [i * self.amount for i in sink.data]

    def do(self, sink: ep.Sink):
        return self.multiply(sink)
        
pipe = ep.PipeBuilderConcrete().command(Multiplier(2)).build()
mySink = ep.ConcreteSink()
mySink.collect([1, 2, 3])
pipe.do(mySink)
print(mySink.data)

Commands need four things to work:

  1. Extends Command class.
  2. Implement do(self, sink: ep.Sink).
  3. Return the data after the operation is completed.

Keep in mind that the Sink will collect all returned values.

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

easypype-1.1.0.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file easypype-1.1.0.tar.gz.

File metadata

  • Download URL: easypype-1.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for easypype-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8e2ff905425dee0a2fb0de307d15b55a9ab466dec69b4ad44e7bd1a0dc38d45a
MD5 c7f9180ff984df1d0c3d9184d50dcd14
BLAKE2b-256 2091f2dfe98e35e97f62e832c8afb6ecb6cdd669f42dc8df4185f923cd0fbfcb

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