Skip to main content

A lightweight framework for parallel data processing using directed acyclic graphs

Project description

Pypeworks

Pypeworks is an open-source framework for implementing parallelized dataflows in Python.

Install

Pypeworks is available through the PyPI repository and can be installed using pip:

pip install pypeworks

Quick start

Pypeworks' central concept is that of the Pipework. A pipework may be defined as a directed acylic graph, wherein each Node serves as a processing unit, taking in data, transforming it, and forwarding it to the next node, until the exit node is reached.

Pypeworks offers two ways to set-up a Pipework. A pipework may be instantiated and constructed on the fly:

from pypeworks import (
    Pipework, 
    Node,
    Connection
)

pipework = (

   Pipework(

      min = Node(
         lambda xs: ("min", min(xs))
      ),

      mean = Node(
         lambda xs: ("mean", sum(xs) / len(xs))
      ),

      max = Node(
         lambda xs: ("max", max(xs))
      ),

      connections = [
         Connection( "enter" , "min"  ),
         Connection( "enter" , "mean" ),
         Connection( "enter" , "max"  ),
         Connection( "min"   , "exit" ),
         Connection( "mean"  , "exit" ),
         Connection( "max"   , "exit" )
      ]

   )

)

print(
   dict(
      pipework([1, 2, 3, 4, 5, 6, 7, 8])
   )
) # {'max': 8, 'mean': 4.5, 'min': 1}

Alternatively, a pipework may be implemented as a templatable, reusable class:

from pypeworks import (
   Pipework
)

class Pipework(Pipework):

   @Pipework.connect(input = "enter")
   @Pipework.connect(output = "exit")
   def min(self, xs : list[int]):
      return ("min", min(xs))

   @Pipework.connect(input = "enter")
   @Pipework.connect(output = "exit")
   def mean(self, xs : list[int]):
      return ("mean", sum(xs) / len(xs))

   @Pipework.connect(input = "enter")
   @Pipework.connect(output = "exit")
   def max(self, xs : list[int]):
      return ("max", max(xs))

print(
   dict(
      Pipework()([1, 2, 3, 4, 5, 6, 7, 8])
   )
) # {'max': 8, 'mean': 4.5, 'min': 1}

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

pypeworks-0.2.0.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypeworks-0.2.0-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file pypeworks-0.2.0.tar.gz.

File metadata

  • Download URL: pypeworks-0.2.0.tar.gz
  • Upload date:
  • Size: 35.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for pypeworks-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cb29992499ffc16c300d526106941ef7d373be8de90b9eaf61be66943f10c88c
MD5 b4276241e0a1724c0e5f7355866883e8
BLAKE2b-256 24f0e9d0eb7b9fb2bc3cf0ef97a155d57a3153102b355cadee9c72e487dd6c55

See more details on using hashes here.

File details

Details for the file pypeworks-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pypeworks-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for pypeworks-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adfc4504ae0d2ad59fea0a16323871501c0f1b724498ffa66fce5c7c435a63d5
MD5 7863dbdd2f994f2db047f3df5a598d1c
BLAKE2b-256 62be86f8ae84a018ec8cff595622e7f2465d21a90f01483072783410b25a451d

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