-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
260 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.12] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[dev] | ||
- name: Run tests | ||
run: pytest | ||
- name: Run type checking | ||
run: mypy src/pypdown | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[dev] | ||
- name: Run linters | ||
run: | | ||
black --check . | ||
isort --check . | ||
flake8 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# API Reference | ||
|
||
## `pypdown.models` | ||
|
||
### `Task` | ||
|
||
```python | ||
class Task(BaseModel): | ||
src: list[Path] | ||
dst: list[Path] | ||
``` | ||
|
||
Represents a task with input (`src`) and output (`dst`) files. | ||
|
||
### `Step` | ||
|
||
```python | ||
class Step(BaseModel): | ||
name: str | ||
tasks: list[Task] | ||
``` | ||
|
||
Represents a named step in a data pipeline, consisting of multiple tasks. | ||
|
||
## `pypdown.run` | ||
|
||
### `run_step` | ||
|
||
```python | ||
def run_step(step: Step): | ||
... | ||
``` | ||
|
||
Executes a pipeline step, checking for file existence and running tasks accordingly. | ||
|
||
For more detailed information on each component, please refer to the source code and inline documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Welcome to pypdown | ||
|
||
pypdown is a Pydantic model-based approach to data pipelining with file I/O linting. | ||
|
||
## 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 | ||
|
||
Check out the [Usage](usage.md) section to get started with pypdown. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Usage | ||
|
||
## Basic Example | ||
|
||
Here's a simple example of how to use pypdown: | ||
|
||
```python | ||
from pypdown import run_step | ||
from pypdown.models import Step | ||
|
||
# Define your pipeline tasks | ||
tasks = [ | ||
(["input.txt"], ["output.txt"]), | ||
(["output.txt"], ["final.txt"]), | ||
] | ||
|
||
# Create a Step | ||
step = Step(name="My Pipeline", tasks=[{"src": s, "dst": d} for s, d in tasks]) | ||
|
||
# Run the step | ||
run_step(step) | ||
``` | ||
|
||
This will create a pipeline that reads from `input.txt`, processes it to create `output.txt`, and then processes `output.txt` to create `final.txt`. | ||
|
||
## Defining Tasks | ||
|
||
Tasks are defined as tuples of input and output files. The first element of the tuple is a list of input files, and the second element is a list of output files. | ||
|
||
## Running Steps | ||
|
||
Use the `run_step` function to execute a pipeline step. This function will check for the existence of input files and the non-existence of output files before running each task. | ||
|
||
For more advanced usage, please refer to the [API Reference](api_reference.md). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def test_package(): | ||
import pypdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
site_name: pypdown | ||
theme: | ||
name: material | ||
palette: | ||
primary: blue | ||
accent: light blue | ||
repo_name: lmmx/pypdown | ||
repo_url: https://github.com/lmmx/pypdown | ||
nav: | ||
- Home: index.md | ||
- Usage: usage.md | ||
- API Reference: api_reference.md | ||
markdown_extensions: | ||
- pymdownx.highlight: | ||
anchor_linenums: true | ||
- pymdownx.inlinehilite | ||
- pymdownx.snippets | ||
- pymdownx.superfences |