No project description provided
Project description
devpipe
devpipe is a little Python package for caching pipeline results.
Installation
Create and activate a virtual environment and then install devpipe:
pip install devpipe
Basic usage
The following example shows a simple ETL pipeline.
import devpipe as dp
@dp.step
def extract(source: str) -> int:
return 1
@dp.step
def transform(data: int) -> int:
return data + 1
@dp.step
def load(data: int) -> bool:
print(data)
return True
@dp.pipeline
def etl(source: str) -> None:
extracted = extract(source=source)
transformed = transform(data=extracted)
response = load(data=transformed)
return response
Results are cached by default based on the decorated function arguments. The following code runs the pipeline twice, but only the first time the pipeline is executed. The second time, the results are loaded from the cache.
res1 = etl(source='source')
res2 = etl(source='source')
assert res1 == res2
You can set a name, force rerun or disable cache both at the step and pipeline levels.
import devpipe as dp
@dp.step(name='My Step', rerun=False, cache=True)
def step_function() -> None:
return None
@dp.pipeline(name='My Pipeline', rerun=True, cache=True)
def pipeline_function() -> None:
return step_function()
Check the documentation for more details.
License
This project is licensed under the terms of the MIT license.
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
File details
Details for the file devpipe-0.1.0.tar.gz
.
File metadata
- Download URL: devpipe-0.1.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.19 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd60b0830a33f4f82732241e1eadfb29a068519f538ed6fa9829f624118a1acd |
|
MD5 | 22a5364e8a6fadb009033ca0dd7bbde6 |
|
BLAKE2b-256 | 51ba02780ae4b204df97fbd2c64c3a40b0e5f68e99df919d600af6098292c079 |
File details
Details for the file devpipe-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: devpipe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.19 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5407a6cab36a57cb5ef1f7373c8a17e12b9e3dcc350bf9be2092b471f367446d |
|
MD5 | 43a20bfd298b1733abfe33c364c3c717 |
|
BLAKE2b-256 | 6402355c81101a7fada17c3d4802e8ba3c9759b2fe32dee17b5db1f6372dd969 |