Skip to main content

Experiments in data flow programming.

https://travis-ci.org/geowurster/tinyflow.svg?branch=master https://coveralls.io/repos/geowurster/tinyflow/badge.svg?branch=master

After some experimentation, Apache Beam’s Python SDK got the API right. Use that instead.

Standard Word Count Example

Grab the 5 most common words in LICENSE.txt

from collections import Counter

from tinyflow.serial import ops, Pipeline


pipe = Pipeline() \
    | "Split line into words" >> ops.flatmap(lambda x: x.lower().split()) \
    | "Remove empty lines" >> ops.filter(bool) \
    | "Produce the 5 most common words" >> ops.counter(5) \
    | "Sort by frequency desc" >> ops.sort(key=lambda x: x[1], reverse=True)

with open('LICENSE.txt') as f:
    results = dict(pipe(f))

Using only Python’s builtins:

from collections import Counter
import itertools as it

with open('LICENSE.txt') as f:
    lines = (line.lower().split() for line in f)
    words = it.chain.from_iterable(lines)
    count = Counter(words)
    results = dict(count.most_common(10))

Developing

$ git clone https://github.com/geowurster/tinyflow.git
$ cd tinyflow
$ pip install -e .\[all\]
$ pytest --cov tinyflow --cov-report term-missing

License

See LICENSE.txt

Changelog

See CHANGES.md

Metadata

Release files for tinyflow 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tinyflow 0.1
File Size Uploaded
tinyflow-0.1.macosx-10.12-x86_64.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tinyflow 0.1
File Interpreter ABI Platform
tinyflow-0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 24.1 kB

Release files / tinyflow-0.1.macosx-10.12-x86_64.tar.gz

Download URL tinyflow-0.1.macosx-10.12-x86_64.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5cdbf7f936f867abb44814d197d262e9429d786c25d66b8f1743cb4160fcb51f
BLAKE2b-256 checksum
How to use checksums
ccb758adbe143cabeb24162a487b974339d8f33c2594d67490c7dca1db05372a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / tinyflow-0.1-py2.py3-none-any.whl

Download URL tinyflow-0.1-py2.py3-none-any.whl
Size 10.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
90c71e8d245725b418ee3528b455d1f3626b7432d1560e937205f3a70e150f1c
BLAKE2b-256 checksum
How to use checksums
122f2fc055de29348a25111b6fce588a9ea013af8f5becb84aa606dbf3f47700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page