Skip to main content

No project description provided

Project description

Pipez - lightweight library for fast deploy stream handling

Install

For installing default version of library use

pip install pipez

If you want install specific version pipez - use

pip install pipez[<your choice>]

Now available cv, fastapi and onnxruntime versions. If you want install pypez with all depencies, you can use

pip install pipez[all]

If you want to install a few version - see nex example:

pip install pipez[cv, onnxruntime]

Quick start

Developing custom node

If you want use your node - you can use Registry.add as class decorator from pipez.registry. You should also import base Node class from pipez.node. For example:

from pipez.core.legacy_node import Node
from pipez.core.legacy_registry import Registry

Registry.add


class MyNode(Node):
    ...

Once required method which you should override: work_func(...) which handle Batch from pipez.batch. However, methods post_init(...) and close(...) also available. See next example:

from typing import Optional

from pipez.core.legacy_batch import Batch, BatchStatus
from pipez.core.legacy_node import Node
from pipez.core.legacy_registry import Registry

Registry.add


class MyNode(Node):
    def __init__(
            self,
            a: int = 1,
            **kwargs
    ):
        super().__init__(**kwargs)
        self._a = a

    def post_init(self):
        self._a *= 10

    def close(self):
        self._a = 0

    def work_func(
            self,
            data: Optional[Batch] = None
    ) -> Batch:
        self._a *= 2
        if self._a > 1000:
            return Batch(status=BatchStatus.END)
        return Batch(data=[dict(a=self._a)])

Build pipelines

When you defined all nodes what you need, we build pipeline from them. You can use json describe or class for node. See next examples:

For using json describing you must add Registry.add as class decorator for you node, else you will get error.

{
    "cls": "MyNode",
    "a": 5,
    "type": "Process",
    "output": "some_trash"
}

For using class you must import your node class.

from pipez.core.legacy_node import NodeType

from ... import MyNode

MyNode(
    a=5,
    type=NodeType.PROCESS,
    output='some_trash'
)

As we can see, we used NodeType, which define type of node.

For building pipeline, we must use build_pipeline from pipez.build. For example:

from pipez.core.legacy_build import build_pipeline
from pipez.nodes import DummyNode
from pipez.core.legacy_node import NodeType
from ... import MyNode

watchdog = build_pipeline(
    pipeline=[
        MyNode(
            a=10,
            type=NodeType.THREAD,
            output='q1'
        ),
        DummyNode(
            type=NodeType.PROCESS,
            input='q1',
            output='q2'
        ),
        DummyNode(
            type=NodeType.THREAD,
            input=['q1, q2'],
            output='q3'
        ),
        {
            "cls": "DummyNode",
            "type": "thread",
            "input": "q3"
        }
    ]
)

As we can see, build_pipeline return watchdog. You can read about it in next section.

WatchDog

TODO

РЎontributors

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pipez-0.0.128.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

pipez-0.0.128-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file pipez-0.0.128.tar.gz.

File metadata

  • Download URL: pipez-0.0.128.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for pipez-0.0.128.tar.gz
Algorithm Hash digest
SHA256 0f2160d5f63e448b385bce9afe0cfe98dbbc38c065de25d7f12a2096739b1253
MD5 78c4b17b8470aa636fd9b7f8bdae8858
BLAKE2b-256 0c4541452f67cb9f57e3a3bc3a05acc642c1d60c9f4c56d06a16044ff998d900

See more details on using hashes here.

File details

Details for the file pipez-0.0.128-py3-none-any.whl.

File metadata

  • Download URL: pipez-0.0.128-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for pipez-0.0.128-py3-none-any.whl
Algorithm Hash digest
SHA256 6040491250c72b4da4c54b1491dc12f3f5b4cd508658e63731f51221ad200818
MD5 1975d48dfcb58cca875fd6201faba1a2
BLAKE2b-256 cfde781b6b95ed4d3ab8b9cd82b517d90f947ffc5cfd0e300d24c5e7a7d0c0bf

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