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

Piper is a pipeline for python objects. It’s great. Go, use it.

Piper enables you to write clean, decoupled functions to process all that dirty data you have. It borrows freely from the UNIX philosophy, processing data much like a shell pipeline. Chain together simple, orthogonal functions, and reduce spaghetti by 95%.

Install

pip install piper

Overview

Each pipe in the pipeline takes an item and a context. It returns an iterable of the outputs, which get passed to the next pipe. It’s strictly serial, so at each stage of the pipeline the first object gets fully processed before anything is done with the second.

flow takes an iterable (your data set), and a list of functions (“pipes”) to pass it through. The output of each pipe serves as the input to the next. The final result is just another iterable.

Session is a communication facility. You can use it as a simple way to share state between pipes, and to skip the remainder of the pipeline for specific outputs.

pipe turns a simple 1-input 1-output function into one that can fit in the pipeline.

verbose is a pipe decorator that prints all the goings on to stdout.

Example

import csv
from dateutil.parser import parse as parsedate
from piper import flow

def to_dict(row, session):
    if 'headings' not in session:
        session['headings'] = row
        return
    val = dict(zip(session['headings'], row))
    val['date'] = parsedate(val['date'])
    val['cost'] = float(val['price']) * float(val['quantity'])
    yield val

def skip_mondays(row, session):
    if row['date'].weekday() != 0:
        yield row

def get_cost(row, session):
    yield row['cost']

rows = csv.reader(some_csv_content)
pipeline = [
    to_dict,
    skip_mondays,
    get_cost,
]

for cost in flow(rows, pipeline):
    print(cost)
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

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
piper-0.1.0.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source Jun 6, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development 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