Metadata-Version: 2.1
Name: pypdown
Version: 0.1.2
Summary: A Pydantic model-based approach to data pipelining with file I/O linting.
Author-Email: Louis Maddox <louismmx@gmail.com>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: pydantic>=2.8.2
Description-Content-Type: text/markdown

# pypdown

A Pydantic model-based approach to data pipelining with file I/O linting.

[![PyPI Version](https://img.shields.io/pypi/v/pypdown)](https://pypi.org/project/pypdown/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pypdown.svg)](https://pypi.org/project/pypdown/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Documentation](https://img.shields.io/badge/docs-pypdown.vercel.app-blue)](https://pypdown.vercel.app/)
[![CI Status](https://github.com/lmmx/pypdown/actions/workflows/ci.yml/badge.svg)](https://github.com/lmmx/pypdown/actions/workflows/ci.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/lmmx/pypdown/master.svg)](https://results.pre-commit.ci/latest/github/lmmx/pypdown/master)

## 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

```bash
pip install pypdown
```

## Quick Start

```python
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](https://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](LICENSE) file for details.
