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.1.3.tar.gz (6.1 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.1.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lazypp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0ac11dd76644684dd300304c19c0e78cc20bc8748cacf32cebd7efd23b43d23c
MD5 8c3c8ed412ef2815733c7f798a121787
BLAKE2b-256 ec622e6cab7f8aba501f11b8a9eb133c0d5191302571f35340879cfaf33df438

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lazypp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.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.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 28bf702a4c5f71e9d38fe16491b3f18d3ec91f4e122447a495e0d0769a570068
MD5 b88c42b52c4040c9a68ca678a2f1c6f9
BLAKE2b-256 a1fe1b2b0650d3ef334385fdd5329b9cd17e9362f86f3bce0b0a5f31cc97e9f2

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