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.3.1.tar.gz (39.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.3.1-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pypeworks-0.3.1.tar.gz
  • Upload date:
  • Size: 39.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.3.1.tar.gz
Algorithm Hash digest
SHA256 037f12df57f661f41650118399a2cd1d9d316fadbc0f4c91f6f0804de6554be9
MD5 1d45c8270e623617993570da3ef23f07
BLAKE2b-256 bdce91a18221c4c47a14eaa043baf322c845e33b40b823ec3bd6a595c4af8e05

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pypeworks-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 46.3 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3de6444bb740c99ff18af2506cc26545e5a839eb9fcfdad53191c85a822af49
MD5 21e487d3777a002719ae94177eb9d927
BLAKE2b-256 257d03d294cb89cfc416781541d99a561cbc6d877132ab91cf203909d8e9f329

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