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": {"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.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pypdown-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pypdown-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 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.0.tar.gz
Algorithm Hash digest
SHA256 44f70ba11f36880d86c1872fb6dca6c3e471c20c5a08945d84755967849a011c
MD5 261a05c467957026743978b48efde590
BLAKE2b-256 ff8d887e7ed16bfb59d535e316b5976812f434ac4f0aff57bf6419f493cafe8b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pypdown-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29ec32d535f4ad8854a49c69b051a93fb1c3e71d246fee319b472d00005947eb
MD5 b14bad08ce5af3b07f9f61e8c74e81d4
BLAKE2b-256 18f7b252bb72cac6c6112f08d5de38b428a5082b207658ac7c331ede3d612d0a

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