Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olirice/flupy
Fluent data pipelines for python and your shell
https://github.com/olirice/flupy
collections data-pipeline fluent python
Last synced: about 7 hours ago
JSON representation
Fluent data pipelines for python and your shell
- Host: GitHub
- URL: https://github.com/olirice/flupy
- Owner: olirice
- License: other
- Created: 2018-01-06T16:46:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-27T14:33:01.000Z (9 months ago)
- Last Synced: 2024-04-14T12:12:08.848Z (7 months ago)
- Topics: collections, data-pipeline, fluent, python
- Language: Python
- Homepage:
- Size: 410 KB
- Stars: 183
- Watchers: 8
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- best-of-python - GitHub - 14% open · ⏱️ 27.02.2024): (Data Pipelines & Streaming)
- awesome-python-machine-learning-resources - GitHub
README
# flupy
---
**Documentation**: https://flupy.readthedocs.io/en/latest/
**Source Code**: https://github.com/olirice/flupy
---
## Overview
Flupy implements a [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface) for operating on python iterables. All flupy methods return generators and are evaluated lazily. This allows expressions to transform arbitrary size data in extremely limited memory.You can think of flupy as a light weight, 0 dependency, pure python alternative to the excellent [Apache Spark](https://spark.apache.org/) project.
## Setup
### Requirements
* Python 3.6+
### Installation
Install flupy with pip:
```sh
$ pip install flupy
```### Library
```python
from itertools import count
from flupy import flu# Processing an infinite sequence in constant memory
pipeline = (
flu(count())
.map(lambda x: x**2)
.filter(lambda x: x % 517 == 0)
.chunk(5)
.take(3)
)for item in pipeline:
print(item)# Returns:
# [0, 267289, 1069156, 2405601, 4276624]
# [6682225, 9622404, 13097161, 17106496, 21650409]
# [26728900, 32341969, 38489616, 45171841, 52388644]
```### CLI
The flupy command line interface brings the same syntax for lazy piplines to your shell. Inputs to the `flu` command are auto-populated into a `Fluent` context named `_`.
````
$ flu -h
usage: flu [-h] [-f FILE] [-i [IMPORT [IMPORT ...]]] commandflupy: a fluent interface for python
positional arguments:
command flupy command to execute on inputoptional arguments:
-h, --help show this help message and exit
-f FILE, --file FILE path to input file
-i [IMPORT [IMPORT ...]], --import [IMPORT [IMPORT ...]]
modules to import
Syntax: ::
Examples:
'import os' = '-i os'
'import os as op_sys' = '-i os::op_sys'
'from os import environ' = '-i os:environ'
'from os import environ as env' = '-i os:environ:env'
````