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
tasks = [
    {
        "src": config.model_dump(include=["input_file"]),
        "dst": config.model_dump(include=["output_file"]),
        "fn": process_input,
    },
    {
        "src": config.model_dump(include=["output_file"]),
        "dst": config.model_dump(include=["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.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

pypdown-0.1.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pypdown-0.1.2.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

Hashes for pypdown-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0d515e8759da8d21756fced35a48c4c62e907b1731a6733e90685cacab080747
MD5 58a9f259c5b71e80cd078fea7fa2e555
BLAKE2b-256 2ae619b6a72e730614ed1f6ff7bf0b14db926d03cf33e26b27d1b642fa21f385

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pypdown-0.1.2-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

Hashes for pypdown-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 651de8dae79398fcb083dde8fb014e4ed68e558f4a146232e2126e0f3c0fcd61
MD5 9f5a74091bfa232d9b6910edd2b95015
BLAKE2b-256 78c3a84017254ca85731507ba851b9200e37a018c1b8f167a15e9838cf91e5c4

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