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()
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-3.0.2.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

pypey-3.0.2-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pypey-3.0.2.tar.gz
  • Upload date:
  • Size: 23.1 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.10

File hashes

Hashes for pypey-3.0.2.tar.gz
Algorithm Hash digest
SHA256 77caf2144c89b40538b49dccd8c09b8a56283cc45bbf98dcb4f3bde8a146ba6d
MD5 233634a25a3253202fcadc5541e2aa7a
BLAKE2b-256 256d56ab81f5fa93fdf1782b5f70a5bf1da86f08cf270facefa8a0eb2b9f6d14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pypey-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 40.2 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.10

File hashes

Hashes for pypey-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c041d4c1ddae1add3527e2ea5bfc5b8ca1ae5b1d83d53ffbbf350d3fd61b5b59
MD5 dc1007981eb323e0f757107fafc73780
BLAKE2b-256 9e6c06a0ad9135eb33b4a0de28ab150f3cb71540a5927364e1afb77820441e36

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