This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

pelper – python helper functions to ease measuring, ignoring, caching, piping, functional helpers, and more for python 2.7, 3.4, and 3.5.

pelper contains useful helper functions, decorators, context managers - all the things that make your python life a tiny bit easier. pelper has no dependencies, has a coverage of 100%, and is well documented.

Examples

Pipe data through unix-like/elixir-like pipes:

>>> from pelper import pipe
>>> pipe("some datat, some data", set, (sorted, {"reverse": True}))
['t', 's', 'o', 'm', 'e', 'd', 'a', ',', ' ']

Pelper offers \(p\)-functions, i.e., functions where the first argument is data. There is pmap (like map, but works with pipel):

>>> from pelper import pipe, pmap
>>> pipe(
...     range(5),
...     (pmap, lambda x: x*x),
...     list)
[0, 1, 4, 9, 16]

…and also pfilter:

>>> from pelper import pipe, pfilter
>>> pipe(
...     range(5),
...     (pfilter, lambda x: x > 2),
...     list)
[3, 4]

Take \(n\) elements from iterables (useful if you can’t use the square bracket notation, e.g., if you’re using pipe)

>>> from pelper import take
>>> take("hello world", 5)
['h', 'e', 'l', 'l', 'o']

Take the \(n\)-th elements from iterables (useful if you can’t use the square bracket notation, e.g., if you’re using pipe)

>>> from pelper import nth
>>> nth(range(5), 2)
2

Flatten arbitrarily nested lists:

>>> from pelper import flatten
>>> flatten([1, [2, 2, [3, 3]]])
[1, 2, 2, 3, 3]

Measure the duration of a function:

>>> from pelper import print_duration
>>> @print_duration()
...  def f(n): pass

Measure the duration of a context:

>>> from pelper import print_duration
>>> with print_duration():
...     range(4)

Ignore exceptions:

>>> from pelper import ignored
>>> with ignored(OSError):
...     raise OSError()  # this is ignored

Cache already computed results of functions:

>>> from pelper import cache
>>> @cache
>>> def fib(n):
...     return 1 if n < 2 else fib(n-1) + fib(n-2)
>>> f(500)  # this would run for quite a wile without the cache decorator

Easier printing and formating:

>>> from pelper import printf
>>> printf("Hello {name}, I'm {something}", name="Alan", something="world")
Hello Alan, I'm world

Installation

pelper is only one file and has no dependencies. You can simply drop pelper.py into your project and use it.

Or install it from pypi by running:

pip install pelper

Or install it from source by running:

pip install .

Development

Use virtualenv for working on pelper. Install the dev requrirements via:

pip install -e requirements-dev.txt

Tests

pelper uses doctest, py.test, and tox for testing. It also has coverage.

You can run the tests for all supported versions of python and build and test the docs:

tox

Run only the tests for the specified version of python:

tox -e py27,py34,py35

Alternatively just run tests for the current version of python:

py.test

Docs

Build the docs via:

cd docs
sphinx html
Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pelper-0.1.0-py2.py3-none-any.whl (9.2 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Jan 16, 2017
pelper-0.1.0.tar.gz (6.5 kB) Copy SHA256 Checksum SHA256 Source Jan 16, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting