Skip to main content

A library for building data pipelines

Project description

Pypey

Library for composing lazily-evaluated data-processing pipelines:

>>> from urllib.request import urlopen
>>> import re
>>> from pypey import pype, px
>>> # prints plain text message from example.com
>>> (pype(urlopen('http://example.com'))
...  .map(bytes.decode, str.split)
...  .flat()
...  .slice(90, 114)
...  .map(px(re.sub, r'\<\/?p\>', ''))
...  .to(' '.join))
'This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.'

Supports argument unpacking:

>>> import os
>>> from pypey import pype
>> # reads environment variables with "PYTHON" in them and prints their name
>>> pype.dict(os.environ).select(lambda key, val: 'PYTHON' in key).pick(0).print(now=True)
PYTHONPATH
IPYTHONENABLE
PYTHONIOENCODING
PYTHONUNBUFFERED
<pypey.pype.Pype object at 0x7ffa54006a30>

Supports parallelism:

>>> from timeit import timeit
>>> timeit("from math import log10; from pypey import pype; pype(range(1, 10_000_000)).map(log10).to(sum, print)", number=5)
65657052.08005966
65657052.08005966
65657052.08005966
65657052.08005966
65657052.08005966
10.055954356997972
>>> timeit("from math import log10; from pypey import pype; pype(range(1, 10_000_000)).map(log10, workers=8).to(sum, print)", number=5)
65657052.08005966
65657052.08005966
65657052.08005966
65657052.08005966
65657052.08005966
5.446932412014576

Installing

Install with pip:

pip install pypey

Testing

Unit tests are written with pytest. Run with:

pip install pytest

pytest

Pypey has been tested with python 3.7, 3.8 and 3.9. A few tests containing positional-only arguments will fail if they are run with 3.7 as it's a feature only available from 3.8 onwards.

Documentation

Extensive documentation at https://pypey.readthedocs.io/en/stable/index.html. Unit tests document through behaviour specification.

Changelog

Check the Changelog for fixes and enhancements of each version.

License

Copyright Jose Llarena 2021.

Distributed under the terms of the MIT license, Pypey is free and open source software.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypey-1.0.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

pypey-1.0.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file pypey-1.0.0.tar.gz.

File metadata

  • Download URL: pypey-1.0.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5

File hashes

Hashes for pypey-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2faced4aed9e79f1a13d1d7d6c5397f15ee9601e80b031298491f0168c05afc0
MD5 4ee923ef8b01ebd60d1293617c631dee
BLAKE2b-256 84dbd4b3d048777d636f9f32858ccfeb0176b2ab4672cbd0c18ab989ea468b9c

See more details on using hashes here.

File details

Details for the file pypey-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pypey-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5

File hashes

Hashes for pypey-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be515f8e7eab01fdace34565fb130b8abfceeb4587b80c42804bfe8869897c25
MD5 bcf122b04343c70819a26540ab671f42
BLAKE2b-256 ca3c8647289b680dfbff6b72c75e536313dcb9c3d5f1d195b8bd1a4f44396af2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page