Skip to main content

A pipeline framework for python

Project description

pipen - A pipeline framework for python

Installation

pip install -U pipen

Quickstart

example.py

from pipen import Proc, Pipen

class Subset(Proc):
    """Subset the input data using pandas"""
    input_keys = 'datafile'
    input = ['https://raw.githubusercontent.com/tidyverse/ggplot2/master/data-raw/mpg.csv']
    output = 'outfile:file:mpg-subset.csv'
    lang = 'python'
    script = """
        import pandas
        data = pandas.read_csv('{{in.datafile}}')
        data = data[['model', 'displ']]
        data.to_csv('{{out.outfile}}')
    """

class Plot(Proc):
    """Plot the data with ggplot2 in R"""
    requires = Subset
    input_keys = 'datafile:file'
    output = 'plotfile:file:mpg.png'
    lang = 'Rscript'
    script = """
        library(ggplot2)
        data = read.csv('{{in.datafile}}')
        png('{{out.plotfile}}')
        ggplot(data) + geom_boxplot(aes(x=model, y=displ)) +
            theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
        dev.off()
    """

if __name__ == '__main__':
    pipen = Pipen(name='plot-mpg', starts=Subset)
    pipen.run()
$ python example.py

example

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pipen-0.0.4.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

pipen-0.0.4-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file pipen-0.0.4.tar.gz.

File metadata

  • Download URL: pipen-0.0.4.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.9.6 Linux/5.8.0-1039-azure

File hashes

Hashes for pipen-0.0.4.tar.gz
Algorithm Hash digest
SHA256 af9f9f36dd515bbddecce0203ed09830ec95051ff611e52a2d2c8164813f05ba
MD5 f12b5ee6ab050aa4d22426c107862549
BLAKE2b-256 d11ffd9e98260d27c53dcb0c876d0339634b07c5aa764d4bc72e29b7d852ac06

See more details on using hashes here.

File details

Details for the file pipen-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pipen-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.9.6 Linux/5.8.0-1039-azure

File hashes

Hashes for pipen-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 612b211f6e9b85cb251e8dab9ee455d1ce96c55efb8a92d9da51292d5aa60797
MD5 d9a11e9a7c3683b5d93842f59fbcff4f
BLAKE2b-256 30276cb1d7283b586398dceffa5adc08e7d0aa699aa10e382a39eea39ef4009a

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