A Pydantic model-based approach to data pipelining with file I/O linting.
Project description
pypdown
A Pydantic model-based approach to data pipelining with file I/O linting.
Features
- Pydantic model-based approach to data pipelining
- File I/O linting for robust pipeline execution
- Easy-to-use API for defining and running pipeline steps
- Support for callback functions and keyword argument-based file paths
Installation
pip install pypdown
Quick Start
from pypdown import run_step
from pypdown.models import Step
from pydantic import BaseModel
from pathlib import Path
class StepParams(BaseModel):
input_file: Path = "input.txt"
output_file: Path = "output.txt"
final_file: Path = "final.txt"
def process_input(input_file: Path, output_file: Path, config: StepParams):
"""Process input file and create output file."""
output_file.write_text(input_file.read_text().upper())
def finalize_output(output_file: Path, final_file: Path, config: StepParams):
"""Process output file and create final file."""
final_file.write_text(f"Processed: {output_file.read_text()}")
config = StepParams()
# Define your pipeline tasks
tasks = [
{
"src": {"input_file": config.input_file},
"dst": {"output_file": config.output_file},
"fn": process_input,
},
{
"src": {"output_file": config.output_file},
"dst": {"final_file": config.final_file},
"fn": finalize_output,
},
]
# Create a Step
step = Step(name="Example Pipeline Step", tasks=tasks, config=config)
# Run the step
run_step(step)
Documentation
For full documentation, please visit pypdown.vercel.app.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
pypdown-0.1.1.tar.gz
(4.3 kB
view details)
Built Distribution
File details
Details for the file pypdown-0.1.1.tar.gz
.
File metadata
- Download URL: pypdown-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.16.1 CPython/3.11.5 Linux/5.15.0-91-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08d286396921a6d2df0bbe5bbec2cbe27f649158276cf81d1fa36a7b6312a242 |
|
MD5 | f40e157b52338700545913e48d4fd9ac |
|
BLAKE2b-256 | 8a6a791f03ec450358cdc2d11276015c63a0a0047523c4f08b41174d821a9f01 |
File details
Details for the file pypdown-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pypdown-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.16.1 CPython/3.11.5 Linux/5.15.0-91-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5417c441f5c2ea12f4385b61eb21ea15081c90fc43038ab22a8808a51805f5 |
|
MD5 | 8e67c75aef04022b7842e4ffc51ec889 |
|
BLAKE2b-256 | 1fbec62a4159cbb3c7fcbe9114bbc4184d88fcbb61683ea7aba6d452e4402657 |