2 files were added to this release more than 14 days after its initial publication. Inspect the release files before installing.
Experimental Pythonic MapReduce inspired by Spotify’s luigi framework.
Canonical Word Count Example
Currently there are two MapReduce implementations, one that includes sorting and one that does not. The example below would not benefit from sorting so we can take advantage of the inherent optimization of not sorting. The API is the same but tinymr.memory.MRSerial() sorts after partitioning and again between the reducer() and final_reducer().
import json
import re
import sys
from tinymr.memory import MRSerial
class WordCount(MRSerial):
def __init__(self):
self.pattern = re.compile('[\W_]+')
def mapper(self, item):
for word in item.split():
word = self.pattern.sub('', word)
if word:
yield word.lower(), 1
def reducer(self, key, values):
yield key, sum(values)
def final_reducer(self, pairs):
return {k: tuple(v)[0] for k, v in pairs}
wc = WordCount()
with open('LICENSE.txt') as f:
out = wc(f)
print(json.dumps(out, indent=4, sort_keys=True))
Truncated output:
{
"a": 1,
"above": 2,
"advised": 1,
"all": 1,
"and": 8,
"andor": 1
}
Developing
$ git clone https://github.com/geowurster/tinymr.git
$ cd tinymr
$ pip install -e .\[dev\]
$ py.test tests --cov tinymr --cov-report term-missing
License
See LICENSE.txt
Changelog
See CHANGES.md
Metadata
Release files for tinymr 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Files added late
2 files were uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tinymr-0.1.tar.gz | 16.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tinymr-0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / tinymr-0.1.tar.gz
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | tinymr-0.1.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bba34762221bcf14696679b11f81810bd5a09258c1a9eec4a1c63cfbc11fe980
|
|
BLAKE2b-256 checksum How to use checksums |
d83cadbb7418a860a1202b7bb8f1dfc296ff43b622512a330ca8919e5edd1b87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / tinymr-0.1-py2.py3-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | tinymr-0.1-py2.py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
093f2359d19a279a1ba88fae77b3af25650245f30ec7c027a99e733e95d1bff9
|
|
BLAKE2b-256 checksum How to use checksums |
0b3a2b8c208985c7e8ee3be96a880b1757076c35bb67d98ae2a9a52948a1e709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |