A Python package named lazypp
Project description
Lazypp
Lazy execution parallel pipeline.
Installation
To install Lazypp, simply run:
pip install lazypp
Usage
- First, create the input and output
TypedDict. - Inherit from
BaseTaskand override thetaskmember 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95c3559aa59b36b2e783150fa660889da736306b8fa529ccb275f7e07d0eeacf
|
|
| MD5 |
0316c8405402ca9d8f8858547ec9f3b5
|
|
| BLAKE2b-256 |
4eff7d6b7ab6774c0a50747c7ae7ca6f2a43cd11bbf003ce78b344e16b82ad03
|
Provenance
The following attestation bundles were made for lazypp-0.2.0.tar.gz:
Publisher:
pypi-publish.yml on gen740/lazypp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lazypp-0.2.0.tar.gz -
Subject digest:
95c3559aa59b36b2e783150fa660889da736306b8fa529ccb275f7e07d0eeacf - Sigstore transparency entry: 145783276
- Sigstore integration time:
-
Permalink:
gen740/lazypp@b7f7ffcb93be836209ef247e703a9aea6bda6548 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gen740
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b7f7ffcb93be836209ef247e703a9aea6bda6548 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
641b978975fee5ca749d12fddcbc5ad192d298cd039d71f82223d4f9bca34931
|
|
| MD5 |
9d6dd952847412cfe50f98947b40143d
|
|
| BLAKE2b-256 |
254780b719b01b292457772e30908ebf400ed2824917cf00cb30e0dab3033b25
|
Provenance
The following attestation bundles were made for lazypp-0.2.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on gen740/lazypp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lazypp-0.2.0-py3-none-any.whl -
Subject digest:
641b978975fee5ca749d12fddcbc5ad192d298cd039d71f82223d4f9bca34931 - Sigstore transparency entry: 145783278
- Sigstore integration time:
-
Permalink:
gen740/lazypp@b7f7ffcb93be836209ef247e703a9aea6bda6548 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gen740
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b7f7ffcb93be836209ef247e703a9aea6bda6548 -
Trigger Event:
push
-
Statement type: