Skip to main content

A Python package named lazypp

Project description

Lazypp

Lazy execution parallel pipeline.

Installation

To install Lazypp, simply run:

pip install lazypp

Usage

  1. First, create the input and output TypedDict.
  2. Inherit from BaseTask and override the task member function.

Here's an example:

import asyncio
from pathlib import Path
from typing import TypedDict

from lazypp import BaseTask

# Define a base class for your tasks
class TestBaseTask(BaseTask[INPUT, OUTPUT]):
    def __init__(self, input: INPUT):
        super().__init__(
            cache_dir=Path("cache").resolve(),
            input=input,
        )

# Define input and output types
class Fin(TypedDict):
    your_name: str

class Fout(TypedDict):
    output: str

# Define a specific task that says hello
class Hello(TestBaseTask[Fin, Fout]):
    async def task(self, input: Fin) -> Fout:
        await asyncio.sleep(3)  # Simulating a long-running task
        return {"output": f"Hello, {input['your_name']}"}

# Create and execute the task
hello_task = Hello(
    input={"your_name": "John"},
)

print(hello_task.result())

Features

Cached Output

The output is automatically cached in the cache_dir according to the input and the code of the task member function. As a result, running the task a second time is much faster than the first execution.

Parallel Execution

Tasks can be nested, and Lazypp will automatically parallelize these tasks to save time and optimize performance.

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

lazypp-0.2.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

lazypp-0.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lazypp-0.2.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for lazypp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 95c3559aa59b36b2e783150fa660889da736306b8fa529ccb275f7e07d0eeacf
MD5 0316c8405402ca9d8f8858547ec9f3b5
BLAKE2b-256 4eff7d6b7ab6774c0a50747c7ae7ca6f2a43cd11bbf003ce78b344e16b82ad03

See more details on using hashes here.

Provenance

The following attestation bundles were made for lazypp-0.2.0.tar.gz:

Publisher: pypi-publish.yml on gen740/lazypp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: lazypp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for lazypp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 641b978975fee5ca749d12fddcbc5ad192d298cd039d71f82223d4f9bca34931
MD5 9d6dd952847412cfe50f98947b40143d
BLAKE2b-256 254780b719b01b292457772e30908ebf400ed2824917cf00cb30e0dab3033b25

See more details on using hashes here.

Provenance

The following attestation bundles were made for lazypp-0.2.0-py3-none-any.whl:

Publisher: pypi-publish.yml on gen740/lazypp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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