Skip to main content

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.

PyPI Version Python Versions License: MIT Documentation CI Status pre-commit.ci status

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 by reference to config field names
task_refs = [
    {
        "src": ["input_file"],
        "dst": ["output_file"],
        "fn": process_input,
    },
    {
        "src": ["output_file"],
        "dst": ["final_file"],
        "fn": finalize_output,
    },
]

# Create a Step
step = Step(name="Example Pipeline Step", task_refs=task_refs, 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.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

pypdown-0.1.4-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file pypdown-0.1.4.tar.gz.

File metadata

  • Download URL: pypdown-0.1.4.tar.gz
  • Upload date:
  • Size: 4.6 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

Hashes for pypdown-0.1.4.tar.gz
Algorithm Hash digest
SHA256 935942e2b51c1f05df8b4765249200aa2879b445ecc0e29577d2d01210133977
MD5 bd87f24e427a2a5b1596684f618a87d4
BLAKE2b-256 808b3fd6c7789fb159222519c8ad0c43e05df42cbb57063b04a0c36758187e85

See more details on using hashes here.

File details

Details for the file pypdown-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pypdown-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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

Hashes for pypdown-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 962db1af33228e655285bea8d719b064dff3aceba03fa7cdb6726e6afd0e3365
MD5 06d1d3d8da78b81c80c88cf278cad07a
BLAKE2b-256 19e9c9177f87bd4fd0832fc9565b0641f671970d81153995e9e8d49a00885c59

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page