Metadata-Version: 2.1
Name: pipen
Version: 0.0.3
Summary: A pipeline framework for python
Home-page: https://github.com/pwwang/pipen
License: MIT
Author: pwwang
Author-email: pwwang@pwwang.com
Requires-Python: >=3.7.1,<4.0.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: cached-property (>=1.0.0,<2.0.0)
Requires-Dist: diot
Requires-Dist: enlighten (>=1.0.0,<2.0.0)
Requires-Dist: liquidpy
Requires-Dist: more-itertools (>=8.0.0,<9.0.0)
Requires-Dist: pandas (>=1.0.0,<2.0.0)
Requires-Dist: pipda
Requires-Dist: pyparam
Requires-Dist: python-simpleconf
Requires-Dist: python-slugify (>=4.0.0,<5.0.0)
Requires-Dist: rich (>=9.0.0,<10.0.0)
Requires-Dist: simplug
Requires-Dist: toml (>=0.10,<0.11)
Requires-Dist: uvloop (<1.0.0)
Requires-Dist: varname
Requires-Dist: xqute
Project-URL: Repository, https://github.com/pwwang/pipen
Description-Content-Type: text/markdown

# pipen - A pipeline framework for python
<!--
[![Pypi][1]][2] [![Github][3]][4] [![PythonVers][5]][2] [![docs][6]][7] [![building][8]][7] [![Codacy][9]][10] [![Codacy coverage][11]][10]

[Documentation][7] | [API][11] | [Change log][12]
-->


## Installation
```bash
pip install -U pipen
```

## Quickstart
`example.py`
```python
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()
```

```shell
$ python example.py
```

![example](example/example.png)

