A pipeline framework for python
Project description
A pipeline framework for python
Documentation | ChangeLog | Examples | API
Features
- Easy to use
- Nearly zero-configuration
- Nice logging
- Highly extendable
Installation
pip install -U pipen
Quickstart
example.py
from pipen import Proc, Pipen
class P1(Proc):
"""Sort input file"""
input = "infile"
input_data = ["/tmp/data.txt"]
output = "outfile:file:intermediate.txt"
script = "cat {{in.infile}} | sort > {{out.outfile}}"
class P2(Proc):
"""Paste line number"""
requires = P1
input = "infile"
output = "outfile:file:result.txt"
script = "paste <(seq 1 3) {{in.infile}} > {{out.outfile}}"
class MyPipeline(Pipen):
starts = P1
if __name__ == "__main__":
MyPipeline().run()
> echo -e "3\n2\n1" > /tmp/data.txt
> python example.py
[09/13/21 04:23:37] I main _____________________________________ __
[09/13/21 04:23:37] I main ___ __ \___ _/__ __ \__ ____/__ | / /
[09/13/21 04:23:37] I main __ /_/ /__ / __ /_/ /_ __/ __ |/ /
[09/13/21 04:23:37] I main _ ____/__/ / _ ____/_ /___ _ /| /
[09/13/21 04:23:37] I main /_/ /___/ /_/ /_____/ /_/ |_/
[09/13/21 04:23:37] I main
[09/13/21 04:23:37] I main version: 0.9.0
[09/13/21 04:23:37] I main
[09/13/21 04:23:37] I main ╭═════════════════════════════ MYPIPELIN ═══════════════════════════════╮
[09/13/21 04:23:37] I main ║ # procs = 2 ║
[09/13/21 04:23:37] I main ║ plugins = ['main', 'verbose-0.0.1'] ║
[09/13/21 04:23:37] I main ║ profile = default ║
[09/13/21 04:23:37] I main ║ outdir = mypipeline_results ║
[09/13/21 04:23:37] I main ║ cache = True ║
[09/13/21 04:23:37] I main ║ dirsig = 1 ║
[09/13/21 04:23:37] I main ║ error_strategy = ignore ║
[09/13/21 04:23:37] I main ║ forks = 1 ║
[09/13/21 04:23:37] I main ║ lang = bash ║
[09/13/21 04:23:37] I main ║ loglevel = info ║
[09/13/21 04:23:37] I main ║ num_retries = 3 ║
[09/13/21 04:23:37] I main ║ plugin_opts = {} ║
[09/13/21 04:23:37] I main ║ plugins = None ║
[09/13/21 04:23:37] I main ║ scheduler = local ║
[09/13/21 04:23:37] I main ║ scheduler_opts = {} ║
[09/13/21 04:23:37] I main ║ submission_batch = 8 ║
[09/13/21 04:23:37] I main ║ template = liquid ║
[09/13/21 04:23:37] I main ║ template_opts = {} ║
[09/13/21 04:23:37] I main ║ workdir = ./.pipen ║
[09/13/21 04:23:37] I main ╰═══════════════════════════════════════════════════════════════════════╯
[09/13/21 04:23:37] I main
[09/13/21 04:23:37] I main ╭───────────────────────────────── P1 ──────────────────────────────────╮
[09/13/21 04:23:37] I main │ Sort input file │
[09/13/21 04:23:37] I main ╰───────────────────────────────────────────────────────────────────────╯
[09/13/21 04:23:37] I main P1: Workdir: '.pipen/mypipeline/p1'
[09/13/21 04:23:37] I main P1: <<< [START]
[09/13/21 04:23:37] I main P1: >>> ['P2']
[09/13/21 04:23:37] I verbose P1: size: 1
[09/13/21 04:23:37] I verbose P1: [0/0] in.infile: /tmp/data.txt
[09/13/21 04:23:37] I verbose P1: [0/0] out.outfile:
/home/pwwang/github/pipen/.pipen/mypipeline/p1/0/output/intermediate.txt
[09/13/21 04:23:38] I verbose P1: Time elapsed: 00:00:01.039s
[09/13/21 04:23:38] I main
[09/13/21 04:23:38] I main ╭═════════════════════════════════ P2 ══════════════════════════════════╮
[09/13/21 04:23:38] I main ║ Paste line number ║
[09/13/21 04:23:38] I main ╰═══════════════════════════════════════════════════════════════════════╯
[09/13/21 04:23:38] I main P2: Workdir: '.pipen/mypipeline/p2'
[09/13/21 04:23:38] I main P2: <<< ['P1']
[09/13/21 04:23:38] I main P2: >>> [END]
[09/13/21 04:23:38] I verbose P2: size: 1
[09/13/21 04:23:38] I verbose P2: [0/0] in.infile:
/home/pwwang/github/pipen/.pipen/mypipeline/p1/0/output/intermediate.txt
[09/13/21 04:23:38] I verbose P2: [0/0] out.outfile:
/home/pwwang/github/pipen/mypipeline_results/P2/result.txt
[09/13/21 04:23:40] I verbose P2: Time elapsed: 00:00:02.074s
[09/13/21 04:23:40] I main
PIPEN-0: 100%|████████████████████████████████████████| 2/2 [00:04<00:00, 0.56 procs/s]
> cat ./mypipeline_results/P2/result.txt
1 1
2 2
3 3
Examples
See more examples at examples/
and a more realcase example at:
https://github.com/pwwang/pipen-report/tree/master/example
Plugin gallery
Plugins make pipen
even better.
pipen-verbose
: Add verbosal information in logs for pipen.pipen-lock
: Process lock for pipen to prevent multiple runs at the same time.pipen-report
: Generate report for pipenpipen-filters
: Add a set of useful filters for pipen templates.pipen-diagram
: Draw pipeline diagrams for pipenpipen-annotate
: Use docstring to annotate pipen processespipen-args
: Command line argument parser for pipenpipen-dry
: Dry runner for pipen pipelinespipen-cli-init
: A pipen CLI plugin to create a pipen project (pipeline)pipen-cli-run
: A pipen cli plugin to run a process or a pipelinepipen-cli-config
: UI wizard to generate configuration for pipen pipelinespipen-cli-require
: A pipen cli plugin check the requirements of a pipeline
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.9.4.tar.gz
(40.1 kB
view details)
Built Distribution
pipen-0.9.4-py3-none-any.whl
(45.3 kB
view details)
File details
Details for the file pipen-0.9.4.tar.gz
.
File metadata
- Download URL: pipen-0.9.4.tar.gz
- Upload date:
- Size: 40.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1035-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a62db7c70283bfeed7be7f511a2f5abe9387bc8d291803ca0576559bf3c17612 |
|
MD5 | d0b7a33d1cdbe44f5cbbf950bb02f589 |
|
BLAKE2b-256 | 2d481e78fb893a4d369dbc4453c0376bff38772066ce123964765f54d4558410 |
File details
Details for the file pipen-0.9.4-py3-none-any.whl
.
File metadata
- Download URL: pipen-0.9.4-py3-none-any.whl
- Upload date:
- Size: 45.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1035-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87777de5346c454cfe5149a3d27458df0868b9e1fc2ee9e6d6dee3047c3b68d9 |
|
MD5 | 7d461581d6d6145e8bddc14d7c0bac11 |
|
BLAKE2b-256 | 7a6214105497ae556dc903fddd26481b027b2c5dacaf82851516ad6b07f65166 |