Python framework to easily build ETLs.
Project description
cupyd
__
/\ \
___ __ __ _____ __ __ \_\ \
/'___\ /\ \/\ \ /\ '__`\ /\ \/\ \ /'_` \
/\ \__/ \ \ \_\ \ \ \ \L\ \ \ \ \_\ \ /\ \L\ \
\ \____\ \ \____/ \ \ ,__/ \/`____ \ \ \___,_\
\/____/ \/___/ \ \ \/ `/___/> \ \/__,_ /
\ \_\ /\___/
\/_/ \/__/
Python framework to create your own ETLs.
Features
- Simple but powerful syntax.
- Modular approach that encourages re-using components across different ETLs.
- Parallelism out-of-the-box without the need of writing multiprocessing code.
- Very compatible:
- Runs on Unix, Windows & MacOS.
- Python >= 3.9
- Lightweight:
Usage
In this example we will compute the factorial of 20.000 integers, using multiprocessing, while storing the results into 2 separate lists, one for even values and another for odd values.
import math
from typing import Any, Iterator
from cupyd import ETL, Extractor, Transformer, Loader, Filter
class IntegerExtractor(Extractor):
def __init__(self, total_items: int):
super().__init__()
self.total_items = total_items
# generated integers will be passed to the workers in buckets of size 10
self.configuration.bucket_size = 10
def extract(self) -> Iterator[int]:
for item in range(self.total_items):
yield item
class Factorial(Transformer):
def transform(self, item: int) -> int:
return math.factorial(item)
class EvenOnly(Filter):
def filter(self, item: int) -> int | None:
return item if item & 1 else None
class OddOnly(Filter):
def filter(self, item: int) -> int | None:
return None if item & 1 else item
class ListLoader(Loader):
def __init__(self):
super().__init__()
self.configuration.run_in_main_process = True
self.items = []
def start(self):
self.items = []
def load(self, item: Any):
self.items.append(item)
if __name__ == "__main__":
# 1. Define the ETL Nodes
ext = IntegerExtractor(total_items=20_000)
factorial = Factorial()
even_only = EvenOnly()
odd_only = OddOnly()
even_ldr = ListLoader()
odd_ldr = ListLoader()
# 2. Connect the Nodes to determine the data flow. Notice the ETL branches after the
# factorial is computed
ext >> factorial >> [even_only >> even_ldr, odd_only >> odd_ldr]
# 3. Run the ETL with 8 workers (multiprocessing Processes)
etl = ETL(extractor=ext)
etl.run(workers=8, show_progress=True, monitor_performance=True)
# 4. You can access the results stored in both Loaders after the ETL is finished
even_factorials = even_ldr.items
odd_factorials = odd_ldr.items
For more information, go the examples directory
💘 (Project under construction)
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
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 cupyd-0.4.0.tar.gz.
File metadata
- Download URL: cupyd-0.4.0.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81d1f349bad8f6de5a2fdee81eeda2a76a2c4522c01fec8fe92115545cad6852
|
|
| MD5 |
dc72b52ee9c5093c6d796d7725bc9bd8
|
|
| BLAKE2b-256 |
eef2cb59c9e754de64935bf5462f6dc7a275ff68fd9c73af5a009cdd5f5458f8
|
Provenance
The following attestation bundles were made for cupyd-0.4.0.tar.gz:
Publisher:
publish.yml on jalorub/cupyd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cupyd-0.4.0.tar.gz -
Subject digest:
81d1f349bad8f6de5a2fdee81eeda2a76a2c4522c01fec8fe92115545cad6852 - Sigstore transparency entry: 227137274
- Sigstore integration time:
-
Permalink:
jalorub/cupyd@c03f110642793b236f56653364035b9ce032b0c4 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jalorub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c03f110642793b236f56653364035b9ce032b0c4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cupyd-0.4.0-py3-none-any.whl.
File metadata
- Download URL: cupyd-0.4.0-py3-none-any.whl
- Upload date:
- Size: 36.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6decbb369e3a493ab32d54ff22d8301de772e1db3aae8e6a2bc94a9903112df
|
|
| MD5 |
8b7966fd59ffa0208caa7a3d5a1e3ffc
|
|
| BLAKE2b-256 |
e0b5de0bb61350544519c2414294c4a54b6e770a7d665a1698cee0ce335e2b65
|
Provenance
The following attestation bundles were made for cupyd-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on jalorub/cupyd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cupyd-0.4.0-py3-none-any.whl -
Subject digest:
b6decbb369e3a493ab32d54ff22d8301de772e1db3aae8e6a2bc94a9903112df - Sigstore transparency entry: 227137275
- Sigstore integration time:
-
Permalink:
jalorub/cupyd@c03f110642793b236f56653364035b9ce032b0c4 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jalorub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c03f110642793b236f56653364035b9ce032b0c4 -
Trigger Event:
release
-
Statement type: