summaryrefslogtreecommitdiff
path: root/python-sspipe.spec
blob: 405ef173543871e061d3414673c5aa3b38ca9ef5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
%global _empty_manifest_terminate_build 0
Name:		python-sspipe
Version:	0.1.17
Release:	1
Summary:	Simple Smart Pipe Operator
License:	MIT License
URL:		https://sspipe.github.io/
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/d4/d1/89b35880c8f25d01a1802322567fd831fdd5b7d62ec3649df85bf3e3e05e/sspipe-0.1.17.tar.gz
BuildArch:	noarch

Requires:	python3-pipe
Requires:	python3-check-manifest
Requires:	python3-coverage

%description
<img src="https://sspipe.github.io/img/icon.png" width="120" align="right"/>

[![Downloads](http://pepy.tech/badge/sspipe)](http://pepy.tech/project/sspipe)
[![Build Status](https://circleci.com/gh/sspipe/sspipe.svg?style=svg)](https://app.circleci.com/pipelines/github/sspipe/sspipe)
[![PyPI](https://badge.fury.io/py/sspipe.svg)](http://pypi.org/project/sspipe)

# Simple Smart Pipe

SSPipe is a python productivity-tool for rapid data manipulation in python.

It helps you break up any complicated expression into a sequence of
simple transformations, increasing human-readability and decreasing the
need for matching parentheses! 

As an example, here is a single line code for reading students' data
from 'data.csv', reporting those in the class 'A19' whose score is more
than the average class score into 'report.csv':

```python
from sspipe import p, px
import pandas as pd

pd.read_csv('data.csv') | px[px['class'] == 'A19'] | px[px.score > px.score.mean()].to_csv('report.csv')
```

As another example, here is a single line code for plotting
sin(x) for points in range(0, 2*pi) where cos(x) is less than 0 in red color:

```python
from sspipe import p, px
import numpy as np
import matplotlib.pyplot as plt

np.linspace(0, 2*np.pi, 100) | px[np.cos(px) < 0] | p(plt.plot, px, np.sin(px), 'r')

# The single-line code above is equivalent to the following code without SSPipe:
# X = np.linspace(0, 2*np.pi, 100)
# X = X[np.cos(X) < 0]
# plt.plot(X, np.sin(X), 'r')
```

If you're familiar with
[`|` operator](https://en.wikipedia.org/wiki/Pipeline_(Unix))
of Unix, or
[`%>%` operator](https://cran.r-project.org/web/packages/magrittr/vignettes/magrittr.html)
of R's magrittr, `sspipe` provides the same functionality in python.

### Installation and Usage
Install sspipe using pip:
```bash
pip install --upgrade sspipe
```
Then import it in your scripts.

```python
from sspipe import p, px
```

The whole functionality
of this library is exposed by two objects `p` (as a wrapper for functions to
be called on the piped object) and `px` (as a placeholder for piped object).

### Examples

| Description | Python expression using `p` and `px` | Equivalent python code |
| --- |:--- |:--- |
| Simple<br>function call | `"hello world!" \| p(print)` | `X = "hello world!"`<br>`print(X)` |
| Function call<br>with extra args | `"hello" \| p(print, "world", end='!')` | `X = "hello"`<br>`print(X, "world", end='!')` |
| Explicitly positioning<br>piped argument<br>with `px` placeholder | `"world" \| p(print, "hello", px, "!")` | `X = "world"`<br>`print("hello", X, "!")` |
| Chaining pipes | `5 \| px + 2 \| px ** 5 + px \| p(print)` | `X = 5`<br>`X = X + 2`<br>`X = X ** 5 + X`<br>`print(X)` |
| Tailored behavior<br>for builtin `map`<br>and `filter` | `(`<br>`  range(5)`<br>`  \| p(filter, px % 2 == 0)`<br>`  \| p(map, px + 10)`<br>`  \| p(list) \| p(print)`<br>`)` | `X = range(5)`<br>`X = filter((lambda x:x%2==0),X)`<br>`X = map((lambda x: x + 10), X)`<br>`X = list(X)`<br>`print(X)` |
| NumPy expressions | `range(10) \| np.sin(px)+1 \| p(plt.plot)` | `X = range(10)`<br>`X = np.sin(X) + 1`<br>`plt.plot(X)` |
| Pandas support | `people_df \| px.loc[px.age > 10, 'name']` | `X = people_df`<br>`X.loc[X.age > 10, 'name']` |
| Assignment | `people_df['name'] \|= px.str.upper()` | `X = people_df['name']`<br>`X = X.str.upper()`<br>`people_df['name'] = X` |
| Pipe as variable | `to_upper = px.strip().upper()`<br>`to_underscore = px.replace(' ', '_')`<br>`normalize = to_upper \| to_underscore`<br>`"  ab cde " \| normalize \| p(print)` | `_f1 = lambda x: x.strip().upper()`<br>`_f2 = lambda x: x.replace(' ','_')`<br>`_f3 = lambda x: _f2(_f1(x))`<br>`X = " ab cde "`<br>`X = _f3(X)`<br>`print(X)` |
| Builtin<br>Data Structures | `2 \| p({px-1: p([px, p((px+1, 4))])})` | `X = 2`<br>`X = {X-1: [X, (X+1, 4)]}` |

### How it works

The expression `p(func, *args, **kwargs)` returns a `Pipe` object that overloads 
`__or__` and `__ror__` operators. This object keeps `func` and `args` and `kwargs` until
evaluation of `x | <Pipe>`, when `Pipe.__ror__` is called by python. Then it will evaluate
`func(x, *args, **kwargs)` and return the result. 

The `px` object is simply `p(lambda x: x)`.

Please notice that SSPipe does not wrap piped objects. On the other hand, it just wraps transforming functions. Therefore, when a variable like `x` is not an instance of `Pipe` class, after python evaluates `y = x | p(func)`, the resulting variable `y` has absolutely no trace of Pipe. Thus, it will be exactly the same object as if we have originally evaluated `y = func(x)`. 

### Common Gotchas

* Incompatibility with `dict.items`, `dict.keys` and `dict.values`:
  
  The objects returned by dict.keys(), dict.values() and dict.items() are
   called [view objects](https://docs.python.org/3.3/library/stdtypes.html#dict-views).
  Python does not allow classes to override the `|` operator on these types. As a workaround,
  the `/` operator has been implemented for view objects. Example:
  ```python3
  # WRONG ERRONEOUS CODE:
  {1: 2, 3: 4}.items() | p(list) | p(print)
  
  # CORRECT CODE (With / operator):
  {1: 2, 3: 4}.items() / p(list) | p(print)
  ```

### Compatibility with JulienPalard/Pipe

This library is inspired by, and depends on, the intelligent and concise work of
 [JulienPalard/Pipe](https://github.com/JulienPalard/Pipe). If you want
 a single `pipe.py` script or a lightweight library that implements core
 functionality and logic of SSPipe, Pipe is perfect.

SSPipe is focused on facilitating usage of pipes, by integration with
 popular libraries and introducing `px` concept and overriding python
 operators to make pipe a first-class citizen.

 Every existing pipe implemented by JulienPalard/Pipe
 library is accessible through `p.<original_name>` and is compatible with SSPipe.
 SSPipe does not implement any specific pipe function and delegates
implementation and naming of pipe functions to JulienPalard/Pipe.

For example, JulienPalard/Pipe's [example](https://github.com/JulienPalard/Pipe#introduction)
for solving "Find the sum of all the even-valued terms in Fibonacci which do not exceed four million."
can be re-written using sspipe:

```python
def fib():
    a, b = 0, 1
    while True:
        yield a
        a, b = b, a + b

from sspipe import p, px

euler2 = (fib() | p.where(lambda x: x % 2 == 0)
                | p.take_while(lambda x: x < 4000000)
                | p.add())
```

You can also pass `px` shorthands to JulienPalard/Pipe API:
```python
euler2 = (fib() | p.where(px % 2 == 0)
                | p.take_while(px < 4000000)
                | p.add())
```




%package -n python3-sspipe
Summary:	Simple Smart Pipe Operator
Provides:	python-sspipe
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-sspipe
<img src="https://sspipe.github.io/img/icon.png" width="120" align="right"/>

[![Downloads](http://pepy.tech/badge/sspipe)](http://pepy.tech/project/sspipe)
[![Build Status](https://circleci.com/gh/sspipe/sspipe.svg?style=svg)](https://app.circleci.com/pipelines/github/sspipe/sspipe)
[![PyPI](https://badge.fury.io/py/sspipe.svg)](http://pypi.org/project/sspipe)

# Simple Smart Pipe

SSPipe is a python productivity-tool for rapid data manipulation in python.

It helps you break up any complicated expression into a sequence of
simple transformations, increasing human-readability and decreasing the
need for matching parentheses! 

As an example, here is a single line code for reading students' data
from 'data.csv', reporting those in the class 'A19' whose score is more
than the average class score into 'report.csv':

```python
from sspipe import p, px
import pandas as pd

pd.read_csv('data.csv') | px[px['class'] == 'A19'] | px[px.score > px.score.mean()].to_csv('report.csv')
```

As another example, here is a single line code for plotting
sin(x) for points in range(0, 2*pi) where cos(x) is less than 0 in red color:

```python
from sspipe import p, px
import numpy as np
import matplotlib.pyplot as plt

np.linspace(0, 2*np.pi, 100) | px[np.cos(px) < 0] | p(plt.plot, px, np.sin(px), 'r')

# The single-line code above is equivalent to the following code without SSPipe:
# X = np.linspace(0, 2*np.pi, 100)
# X = X[np.cos(X) < 0]
# plt.plot(X, np.sin(X), 'r')
```

If you're familiar with
[`|` operator](https://en.wikipedia.org/wiki/Pipeline_(Unix))
of Unix, or
[`%>%` operator](https://cran.r-project.org/web/packages/magrittr/vignettes/magrittr.html)
of R's magrittr, `sspipe` provides the same functionality in python.

### Installation and Usage
Install sspipe using pip:
```bash
pip install --upgrade sspipe
```
Then import it in your scripts.

```python
from sspipe import p, px
```

The whole functionality
of this library is exposed by two objects `p` (as a wrapper for functions to
be called on the piped object) and `px` (as a placeholder for piped object).

### Examples

| Description | Python expression using `p` and `px` | Equivalent python code |
| --- |:--- |:--- |
| Simple<br>function call | `"hello world!" \| p(print)` | `X = "hello world!"`<br>`print(X)` |
| Function call<br>with extra args | `"hello" \| p(print, "world", end='!')` | `X = "hello"`<br>`print(X, "world", end='!')` |
| Explicitly positioning<br>piped argument<br>with `px` placeholder | `"world" \| p(print, "hello", px, "!")` | `X = "world"`<br>`print("hello", X, "!")` |
| Chaining pipes | `5 \| px + 2 \| px ** 5 + px \| p(print)` | `X = 5`<br>`X = X + 2`<br>`X = X ** 5 + X`<br>`print(X)` |
| Tailored behavior<br>for builtin `map`<br>and `filter` | `(`<br>`  range(5)`<br>`  \| p(filter, px % 2 == 0)`<br>`  \| p(map, px + 10)`<br>`  \| p(list) \| p(print)`<br>`)` | `X = range(5)`<br>`X = filter((lambda x:x%2==0),X)`<br>`X = map((lambda x: x + 10), X)`<br>`X = list(X)`<br>`print(X)` |
| NumPy expressions | `range(10) \| np.sin(px)+1 \| p(plt.plot)` | `X = range(10)`<br>`X = np.sin(X) + 1`<br>`plt.plot(X)` |
| Pandas support | `people_df \| px.loc[px.age > 10, 'name']` | `X = people_df`<br>`X.loc[X.age > 10, 'name']` |
| Assignment | `people_df['name'] \|= px.str.upper()` | `X = people_df['name']`<br>`X = X.str.upper()`<br>`people_df['name'] = X` |
| Pipe as variable | `to_upper = px.strip().upper()`<br>`to_underscore = px.replace(' ', '_')`<br>`normalize = to_upper \| to_underscore`<br>`"  ab cde " \| normalize \| p(print)` | `_f1 = lambda x: x.strip().upper()`<br>`_f2 = lambda x: x.replace(' ','_')`<br>`_f3 = lambda x: _f2(_f1(x))`<br>`X = " ab cde "`<br>`X = _f3(X)`<br>`print(X)` |
| Builtin<br>Data Structures | `2 \| p({px-1: p([px, p((px+1, 4))])})` | `X = 2`<br>`X = {X-1: [X, (X+1, 4)]}` |

### How it works

The expression `p(func, *args, **kwargs)` returns a `Pipe` object that overloads 
`__or__` and `__ror__` operators. This object keeps `func` and `args` and `kwargs` until
evaluation of `x | <Pipe>`, when `Pipe.__ror__` is called by python. Then it will evaluate
`func(x, *args, **kwargs)` and return the result. 

The `px` object is simply `p(lambda x: x)`.

Please notice that SSPipe does not wrap piped objects. On the other hand, it just wraps transforming functions. Therefore, when a variable like `x` is not an instance of `Pipe` class, after python evaluates `y = x | p(func)`, the resulting variable `y` has absolutely no trace of Pipe. Thus, it will be exactly the same object as if we have originally evaluated `y = func(x)`. 

### Common Gotchas

* Incompatibility with `dict.items`, `dict.keys` and `dict.values`:
  
  The objects returned by dict.keys(), dict.values() and dict.items() are
   called [view objects](https://docs.python.org/3.3/library/stdtypes.html#dict-views).
  Python does not allow classes to override the `|` operator on these types. As a workaround,
  the `/` operator has been implemented for view objects. Example:
  ```python3
  # WRONG ERRONEOUS CODE:
  {1: 2, 3: 4}.items() | p(list) | p(print)
  
  # CORRECT CODE (With / operator):
  {1: 2, 3: 4}.items() / p(list) | p(print)
  ```

### Compatibility with JulienPalard/Pipe

This library is inspired by, and depends on, the intelligent and concise work of
 [JulienPalard/Pipe](https://github.com/JulienPalard/Pipe). If you want
 a single `pipe.py` script or a lightweight library that implements core
 functionality and logic of SSPipe, Pipe is perfect.

SSPipe is focused on facilitating usage of pipes, by integration with
 popular libraries and introducing `px` concept and overriding python
 operators to make pipe a first-class citizen.

 Every existing pipe implemented by JulienPalard/Pipe
 library is accessible through `p.<original_name>` and is compatible with SSPipe.
 SSPipe does not implement any specific pipe function and delegates
implementation and naming of pipe functions to JulienPalard/Pipe.

For example, JulienPalard/Pipe's [example](https://github.com/JulienPalard/Pipe#introduction)
for solving "Find the sum of all the even-valued terms in Fibonacci which do not exceed four million."
can be re-written using sspipe:

```python
def fib():
    a, b = 0, 1
    while True:
        yield a
        a, b = b, a + b

from sspipe import p, px

euler2 = (fib() | p.where(lambda x: x % 2 == 0)
                | p.take_while(lambda x: x < 4000000)
                | p.add())
```

You can also pass `px` shorthands to JulienPalard/Pipe API:
```python
euler2 = (fib() | p.where(px % 2 == 0)
                | p.take_while(px < 4000000)
                | p.add())
```




%package help
Summary:	Development documents and examples for sspipe
Provides:	python3-sspipe-doc
%description help
<img src="https://sspipe.github.io/img/icon.png" width="120" align="right"/>

[![Downloads](http://pepy.tech/badge/sspipe)](http://pepy.tech/project/sspipe)
[![Build Status](https://circleci.com/gh/sspipe/sspipe.svg?style=svg)](https://app.circleci.com/pipelines/github/sspipe/sspipe)
[![PyPI](https://badge.fury.io/py/sspipe.svg)](http://pypi.org/project/sspipe)

# Simple Smart Pipe

SSPipe is a python productivity-tool for rapid data manipulation in python.

It helps you break up any complicated expression into a sequence of
simple transformations, increasing human-readability and decreasing the
need for matching parentheses! 

As an example, here is a single line code for reading students' data
from 'data.csv', reporting those in the class 'A19' whose score is more
than the average class score into 'report.csv':

```python
from sspipe import p, px
import pandas as pd

pd.read_csv('data.csv') | px[px['class'] == 'A19'] | px[px.score > px.score.mean()].to_csv('report.csv')
```

As another example, here is a single line code for plotting
sin(x) for points in range(0, 2*pi) where cos(x) is less than 0 in red color:

```python
from sspipe import p, px
import numpy as np
import matplotlib.pyplot as plt

np.linspace(0, 2*np.pi, 100) | px[np.cos(px) < 0] | p(plt.plot, px, np.sin(px), 'r')

# The single-line code above is equivalent to the following code without SSPipe:
# X = np.linspace(0, 2*np.pi, 100)
# X = X[np.cos(X) < 0]
# plt.plot(X, np.sin(X), 'r')
```

If you're familiar with
[`|` operator](https://en.wikipedia.org/wiki/Pipeline_(Unix))
of Unix, or
[`%>%` operator](https://cran.r-project.org/web/packages/magrittr/vignettes/magrittr.html)
of R's magrittr, `sspipe` provides the same functionality in python.

### Installation and Usage
Install sspipe using pip:
```bash
pip install --upgrade sspipe
```
Then import it in your scripts.

```python
from sspipe import p, px
```

The whole functionality
of this library is exposed by two objects `p` (as a wrapper for functions to
be called on the piped object) and `px` (as a placeholder for piped object).

### Examples

| Description | Python expression using `p` and `px` | Equivalent python code |
| --- |:--- |:--- |
| Simple<br>function call | `"hello world!" \| p(print)` | `X = "hello world!"`<br>`print(X)` |
| Function call<br>with extra args | `"hello" \| p(print, "world", end='!')` | `X = "hello"`<br>`print(X, "world", end='!')` |
| Explicitly positioning<br>piped argument<br>with `px` placeholder | `"world" \| p(print, "hello", px, "!")` | `X = "world"`<br>`print("hello", X, "!")` |
| Chaining pipes | `5 \| px + 2 \| px ** 5 + px \| p(print)` | `X = 5`<br>`X = X + 2`<br>`X = X ** 5 + X`<br>`print(X)` |
| Tailored behavior<br>for builtin `map`<br>and `filter` | `(`<br>`  range(5)`<br>`  \| p(filter, px % 2 == 0)`<br>`  \| p(map, px + 10)`<br>`  \| p(list) \| p(print)`<br>`)` | `X = range(5)`<br>`X = filter((lambda x:x%2==0),X)`<br>`X = map((lambda x: x + 10), X)`<br>`X = list(X)`<br>`print(X)` |
| NumPy expressions | `range(10) \| np.sin(px)+1 \| p(plt.plot)` | `X = range(10)`<br>`X = np.sin(X) + 1`<br>`plt.plot(X)` |
| Pandas support | `people_df \| px.loc[px.age > 10, 'name']` | `X = people_df`<br>`X.loc[X.age > 10, 'name']` |
| Assignment | `people_df['name'] \|= px.str.upper()` | `X = people_df['name']`<br>`X = X.str.upper()`<br>`people_df['name'] = X` |
| Pipe as variable | `to_upper = px.strip().upper()`<br>`to_underscore = px.replace(' ', '_')`<br>`normalize = to_upper \| to_underscore`<br>`"  ab cde " \| normalize \| p(print)` | `_f1 = lambda x: x.strip().upper()`<br>`_f2 = lambda x: x.replace(' ','_')`<br>`_f3 = lambda x: _f2(_f1(x))`<br>`X = " ab cde "`<br>`X = _f3(X)`<br>`print(X)` |
| Builtin<br>Data Structures | `2 \| p({px-1: p([px, p((px+1, 4))])})` | `X = 2`<br>`X = {X-1: [X, (X+1, 4)]}` |

### How it works

The expression `p(func, *args, **kwargs)` returns a `Pipe` object that overloads 
`__or__` and `__ror__` operators. This object keeps `func` and `args` and `kwargs` until
evaluation of `x | <Pipe>`, when `Pipe.__ror__` is called by python. Then it will evaluate
`func(x, *args, **kwargs)` and return the result. 

The `px` object is simply `p(lambda x: x)`.

Please notice that SSPipe does not wrap piped objects. On the other hand, it just wraps transforming functions. Therefore, when a variable like `x` is not an instance of `Pipe` class, after python evaluates `y = x | p(func)`, the resulting variable `y` has absolutely no trace of Pipe. Thus, it will be exactly the same object as if we have originally evaluated `y = func(x)`. 

### Common Gotchas

* Incompatibility with `dict.items`, `dict.keys` and `dict.values`:
  
  The objects returned by dict.keys(), dict.values() and dict.items() are
   called [view objects](https://docs.python.org/3.3/library/stdtypes.html#dict-views).
  Python does not allow classes to override the `|` operator on these types. As a workaround,
  the `/` operator has been implemented for view objects. Example:
  ```python3
  # WRONG ERRONEOUS CODE:
  {1: 2, 3: 4}.items() | p(list) | p(print)
  
  # CORRECT CODE (With / operator):
  {1: 2, 3: 4}.items() / p(list) | p(print)
  ```

### Compatibility with JulienPalard/Pipe

This library is inspired by, and depends on, the intelligent and concise work of
 [JulienPalard/Pipe](https://github.com/JulienPalard/Pipe). If you want
 a single `pipe.py` script or a lightweight library that implements core
 functionality and logic of SSPipe, Pipe is perfect.

SSPipe is focused on facilitating usage of pipes, by integration with
 popular libraries and introducing `px` concept and overriding python
 operators to make pipe a first-class citizen.

 Every existing pipe implemented by JulienPalard/Pipe
 library is accessible through `p.<original_name>` and is compatible with SSPipe.
 SSPipe does not implement any specific pipe function and delegates
implementation and naming of pipe functions to JulienPalard/Pipe.

For example, JulienPalard/Pipe's [example](https://github.com/JulienPalard/Pipe#introduction)
for solving "Find the sum of all the even-valued terms in Fibonacci which do not exceed four million."
can be re-written using sspipe:

```python
def fib():
    a, b = 0, 1
    while True:
        yield a
        a, b = b, a + b

from sspipe import p, px

euler2 = (fib() | p.where(lambda x: x % 2 == 0)
                | p.take_while(lambda x: x < 4000000)
                | p.add())
```

You can also pass `px` shorthands to JulienPalard/Pipe API:
```python
euler2 = (fib() | p.where(px % 2 == 0)
                | p.take_while(px < 4000000)
                | p.add())
```




%prep
%autosetup -n sspipe-0.1.17

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-sspipe -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.17-1
- Package Spec generated