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.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

pypdown-0.1.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pypdown-0.1.3.tar.gz
  • Upload date:
  • Size: 4.5 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.3.tar.gz
Algorithm Hash digest
SHA256 db776c6df1ad9bf1b092f6543aae032f3a78d578fada3473d9b0b3cbf3b20f18
MD5 4e62edf92532104fefa77d85206bdcf5
BLAKE2b-256 78db6c6fd0200b180578db663bf6f6e6a8d9de90fd17d0e17b2f771d3f5090a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pypdown-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 509076274c706d6a438a1fbf52869afb9950db5c5c53b7a3f9c7a64f509ec169
MD5 7d4fc410412c28efead67a5ea6e0006b
BLAKE2b-256 cca25a5578b6513a3a671101800240eec058cb6c305cc8cf46c570daeebe72c7

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