Skip to content

sotte/pelper

Repository files navigation

pelper - python helper functions

read the docs Coverage status Build status PyPI page Github page

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:

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

...and also pfilter:

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

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

Flatten arbitrarily nested lists:

Measure the duration of a function:

Measure the duration of a context:

Ignore exceptions:

Cache already computed results of functions:

Easier printing and formating:

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 status 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

About

pelper -- python helper functions to ease measuring, ignoring, caching, ...

Resources

License

Stars

Watchers

Forks

Packages

No packages published