Skip to content

Commit 114c4a4

Browse files
authored
Merge pull request #7 from pyper-dev/docs
fix type hints and update docs
2 parents d835e73 + 8a1a32b commit 114c4a4

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Let's simulate a pipeline that performs a series of transformations on some data
5151
```python
5252
import asyncio
5353
import time
54-
import typing
54+
from typing import AsyncIterable
5555

5656
from pyper import task
5757

@@ -76,7 +76,7 @@ def step3(data: int):
7676
return 2 * data - 1
7777

7878

79-
async def print_sum(data: typing.AsyncGenerator[int]):
79+
async def print_sum(data: AsyncIterable[int]):
8080
"""Print the sum of values from a data stream."""
8181
total = 0
8282
async for output in data:
@@ -234,7 +234,7 @@ No-- not every program is asynchronous, so Pyper pipelines are by default synchr
234234

235235
```python
236236
import time
237-
import typing
237+
from typing import Iterable
238238

239239
from pyper import task
240240

@@ -254,7 +254,7 @@ def step3(data: int):
254254
return 2 * data - 1
255255

256256

257-
def print_sum(data: typing.Generator[int]):
257+
def print_sum(data: Iterable[int]):
258258
total = 0
259259
for output in data:
260260
total += output

docs/src/docs/UserGuide/CombiningPipelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Consumer functions will, however need to adapt to asynchronous output. For examp
125125
```python
126126
import asyncio
127127
import json
128-
from typing import Dict, Iterable
128+
from typing import AsyncIterable, Dict
129129

130130
from pyper import task
131131

@@ -142,7 +142,7 @@ class JsonFileWriter:
142142
def __init__(self, filepath):
143143
self.filepath = filepath
144144

145-
async def __call__(self, data: Iterable[Dict]):
145+
async def __call__(self, data: AsyncIterable[Dict]):
146146
data_list = [row async for row in data]
147147
with open(self.filepath, 'w', encoding='utf-8') as f:
148148
json.dump(data_list, f, indent=4)

docs/src/docs/UserGuide/Considerations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permalink: /docs/UserGuide/Considerations
1212
1. TOC
1313
{:toc}
1414

15-
## Just Add More Workers?
15+
## How Many Workers?
1616

1717
Pyper is a framework for concurrent programming, so it is worth discussing in a little more detail what the [concurrency](TaskParameters#concurrency) parameter is doing. Under the hood, this is an integer which determines:
1818

@@ -34,7 +34,7 @@ A function with this property is referred as IO-bound, whereas a function that h
3434
* Sorting and searching
3535

3636
{: .warning}
37-
Increasing the number of workers for a task does not improve performance if the task is CPU-bound
37+
Increasing the number of workers for a CPU-bound task does not improve performance
3838

3939
To experiment for yourself, try running the following script with a range of concurrency values. You'll notice that a higher concurrency will in fact decrease performance, due to the overhead of creating threads.
4040

docs/src/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ permalink: /
1212
<p align="center" style="font-size: 1.5em;">
1313
<em>Concurrent Python made simple</em>
1414
</p>
15+
16+
<p align="center">
17+
<a href="https://github.com/pyper-dev/pyper/actions/workflows/test.yml" target="_blank">
18+
<img src="https://github.com/pyper-dev/pyper/actions/workflows/test.yml/badge.svg" alt="Test">
19+
</a>
20+
<a href="https://coveralls.io/github/pyper-dev/pyper" target="_blank">
21+
<img src="https://coveralls.io/repos/github/pyper-dev/pyper/badge.svg" alt="Coverage">
22+
</a>
23+
<a href="https://pypi.org/project/python-pyper" target="_blank">
24+
<img src="https://img.shields.io/pypi/v/python-pyper?color=%2334D058&label=pypi%20package" alt="Package version">
25+
</a>
26+
<a href="https://pypi.org/project/python-pyper" target="_blank">
27+
<img src="https://img.shields.io/pypi/pyversions/python-pyper.svg?color=%2334D058" alt="Supported Python versions">
28+
</a>
29+
</p>
30+
1531
---
1632

1733
<br>

0 commit comments

Comments
 (0)