Skip to content

Commit 4c327f7

Browse files
authored
Merge pull request #12 from pyper-dev/dev
Add multiprocessing support
2 parents cd0bf6b + 8761fe6 commit 4c327f7

31 files changed

+1256
-708
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222

2323
---
2424

25-
Pyper is a generalized framework for concurrent data-processing, based on functional programming patterns. Used for 🌐 **Data Collection**, 🔀 **ETL systems**, and general-purpose 🛠️ **Python Scripting**
25+
Pyper is a comprehensive framework for concurrent and parallel data-processing, based on functional programming patterns. Used for 🌐 **Data Collection**, 🔀 **ETL Systems**, and general-purpose 🛠️ **Python Scripting**
2626

2727
See the [Documentation](https://pyper-dev.github.io/pyper/)
2828

2929
Key features:
3030

3131
* 💡**Intuitive API**: Easy to learn, easy to think about. Implements clean abstractions to seamlessly unify threaded and asynchronous work.
3232
* 🚀 **Functional Paradigm**: Python functions are the building blocks of data pipelines. Let's you write clean, reusable code naturally.
33-
* 🛡️ **Safety**: Hides the heavy lifting of underlying task creation and execution. No more worrying about race conditions, memory leaks, and thread-level error handling.
33+
* 🛡️ **Safety**: Hides the heavy lifting of underlying task execution and resource clean-up. No more worrying about race conditions, memory leaks, or thread-level error handling.
3434
***Efficiency**: Designed from the ground up for lazy execution, using queues, workers, and generators.
3535
***Pure Python**: Lightweight, with zero sub-dependencies.
3636

@@ -284,9 +284,11 @@ To explore more of Pyper's features, see some further [examples](https://pyper-d
284284

285285
## Dependencies
286286

287-
Pyper is implemented in pure Python, with no sub-dependencies. It relies heavily on the well-established built-in modules:
288-
* [asyncio](https://docs.python.org/3/library/asyncio.html) for handling async-based concurrency
289-
* [threading](https://docs.python.org/3/library/threading.html) for handling thread-based concurrency
287+
Pyper is implemented in pure Python, with no sub-dependencies. It is built on top of the well-established built-in Python modules:
288+
* [threading](https://docs.python.org/3/library/threading.html) for thread-based concurrency
289+
* [multiprocessing](https://docs.python.org/3/library/multiprocessing.html) for parallelism
290+
* [asyncio](https://docs.python.org/3/library/asyncio.html) for async-based concurrency
291+
* [concurrent.futures](https://docs.python.org/3/library/concurrent.futures.html) for unifying threads, processes, and async code
290292

291293
## License
292294

docs/src/assets/img/diagram1.png

39.3 KB
Loading

docs/src/assets/img/diagram2.png

92.2 KB
Loading
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: AsyncPipeline
3+
parent: API Reference
4+
layout: default
5+
nav_order: 3
6+
permalink: /docs/ApiReference/AsyncPipeline
7+
---
8+
9+
# pyper.AsyncPipeline
10+
{: .no_toc }
11+
12+
`AsyncPipeline` is a sublass of [Pipeline](Pipeline) and exposes the same API.
13+
14+
[Example](../UserGuide/CreatingPipelines#asynchronous-code)
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Pipeline
3+
parent: API Reference
4+
layout: default
5+
nav_order: 2
6+
permalink: /docs/ApiReference/Pipeline
7+
---
8+
9+
# pyper.Pipeline
10+
{: .no_toc }
11+
12+
* TOC
13+
{:toc}
14+
15+
## Pipeline
16+
17+
```python
18+
def __new__(cls, tasks: List[Task]) -> Pipeline:
19+
```
20+
21+
An object that represents a data flow consisting of a series of (at least one) tasks.
22+
23+
{: .warning}
24+
It is not recommended to instantiate a `Pipeline` directly. Use the [task](task) class
25+
26+
## Pipeline.\__call__
27+
28+
```python
29+
def __call__(self, *args, **kwargs) -> Generator[Any, None, None]:
30+
```
31+
32+
A `Pipeline` is a callable object with the parameter specification of its first task which generates each output from its last task.
33+
34+
[Example](../UserGuide/CreatingPipelines#pipeline-usage)
35+
36+
## Pipeline.pipe
37+
38+
```python
39+
def pipe(self, other: Pipeline) -> Pipeline:
40+
```
41+
42+
Allows two `Pipeline` objects to be composed together, returning a new pipeline with a combined list of tasks.
43+
44+
[Example](../UserGuide/ComposingPipelines#piping-and-the--operator)
45+
46+
## Pipeline.\__or__
47+
48+
```python
49+
def __or__(self, other: Pipeline) -> Pipeline:
50+
```
51+
52+
Allows the use of the operator `|` as syntactic sugar for `Pipeline.pipe`.
53+
54+
## Pipeline.consume
55+
56+
```python
57+
def consume(self, other: Callable) -> Callable:
58+
```
59+
60+
Allows a consumer function to be attached to a `Pipeline`.
61+
62+
[Example](../UserGuide/ComposingPipelines#consumer-functions-and-the--operator)
63+
64+
65+
## Pipeline.\__gt__
66+
67+
```python
68+
def __gt__(self, other: Callable) -> Callable:
69+
```
70+
71+
Allows the use of the operator `>` as syntactic sugar for `Pipeline.consume`.

docs/src/docs/ApiReference/index.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,4 @@ nav_order: 4
44
layout: page
55
---
66

7-
# API Reference
8-
9-
All pipelines in Pyper are created with the `pyper.task` decorator.
10-
11-
See [Task Parameters](../UserGuide/TaskParameters)
7+
# API Reference

0 commit comments

Comments
 (0)