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

Uploaded Source

Built Distribution

pipen-0.0.3-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pipen-0.0.3.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.4.0-1047-azure

File hashes

Hashes for pipen-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ede20fcd6b21eb37a49d6a550dfe20f4c154b3e180e4b12e892d8e0c91509605
MD5 dd4538f508494136e552dab1830eafe2
BLAKE2b-256 0b30e42fcebb45728f89844801f58efbcc01b92d040b551a8c7e376fb56d0a74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pipen-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.4.0-1047-azure

File hashes

Hashes for pipen-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 34b3168414b3f046cdf9da9688b847ce11a0105f57131e40a940838c7432b703
MD5 779268067fc3217a378a44b2dc9a1117
BLAKE2b-256 55bf22800c106e3b2e5c75e1f811e3cd7e0d2fec163138caf4abcf90c967b3ed

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