Skip to main content

Using a defined data schema to pass data between nodes in the pipeli.

Project description

Pipe-by-Schema

Release Pipeline License: MIT Code Style: Black

Using defined data schema to passing between nodes of pipeline, much more easier to maintain your complex workflow.

Installation

  • Python 3.9+
  • poetry 1.7.1
pip install pipesche

or

poetry install

Quick Start

  1. Implement the run method of node class and define input and output schema.
from dataclasses import dataclass

from pipesche import BaseNode


@dataclass
class AddPayload:
    x: int
    y: int


class Add(BaseNode[AddPayload, int]):
    def run(self, payload: AddPayload) -> int:
        result = payload.x + payload.y
        print(f"{payload.x} + {payload.y} = {result}")
        return result


class PrintSomeThing(BaseNode[None, None]):
    def run(self, payload: None) -> None:
        print("Some thing...")
  1. Add the nodes to pipeline and link the nodes.
from pipesche import Pipeline


node_1 = Add("node_1")
node_2 = PrintSomeThing("node_2")
node_3 = Add("node_3")

pipeline = Pipeline()
pipeline.add_node(node_1, input_key="input_1")
pipeline.add_node(node_2)
pipeline.add_node(node_3, input_key="input_2")
pipeline.connect(node_1.name, node_3.name)
pipeline.connect(node_3.name, node_2.name)

pipeline.run({"input_1": AddPayload(1, 2), "input_2": AddPayload(3, 4)})

# Output:
# 1 + 2 = 3
# 3 + 4 = 7
# Some thing...
  1. Get the result of the node.
pipeline.get_data(key=node_3.name)

# Output:
# 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

pipesche-0.1.8.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

pipesche-0.1.8-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file pipesche-0.1.8.tar.gz.

File metadata

  • Download URL: pipesche-0.1.8.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/6.5.0-1025-azure

File hashes

Hashes for pipesche-0.1.8.tar.gz
Algorithm Hash digest
SHA256 bb7a7d3b0d4d3365aa3af04f311c2275272061feb66c4d3373d736e85747247d
MD5 9933c0082d41fde342cc798a54565c15
BLAKE2b-256 585b4a68c32823e8545ab3fae4e8eefb0d34c43742536d43cc445876c2dbc0f1

See more details on using hashes here.

File details

Details for the file pipesche-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: pipesche-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/6.5.0-1025-azure

File hashes

Hashes for pipesche-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 abd5887ba1ffb55526dc0e7b11ed915d3ecf3438bf949324d6774e534c4c3cc6
MD5 ce1ee34ce4c9529ad11399651129dfc1
BLAKE2b-256 e26a507fd78243b9898ee0378654c70af8838613943e0554ad9f0f6e11c90b44

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