Skip to main content

A pipeline framework for python

Project description

A pipeline framework for python


Pypi Github Building Docs and API Codacy Codacy coverage

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}}"

Pipen().run(P1)
> 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.1.0
[09/13/21 04:23:37] I main
[09/13/21 04:23:37] I main    ╭══════════════════════════════════ PIPEN-0 ═══════════════════════════════════╮
[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           = pipen-0_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/pipen-0/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/pipen-0/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/pipen-0/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/pipen-0/p1/0/output/intermediate.txt
[09/13/21 04:23:38] I verbose P2: [0/0] out.outfile: /home/pwwang/github/pipen/pipen-0_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 ./pipen-0_results/P2/result.txt
1       1
2       2
3       3

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

Uploaded Source

Built Distribution

pipen-0.1.0-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pipen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7d29a81b7fc61308e65cc2d07233eb43bf51729c720985bcbc2429cf3e69fcf5
MD5 a9308ea750a8a48c23edaeef8ed33c8d
BLAKE2b-256 5ece22f218cc5da0b7c92dd8c664b19e223293579d87e5e671a29524f26918b3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pipen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 faa88e766f1cae02cf50b183dd688b7f36fb3f21323c1a2ec0a841dcb98cbc2c
MD5 88cfa3e486b70a773255319af02cd941
BLAKE2b-256 b0367788c4cbfedd2a17eb16d264fa69e66cd8f74be503e12f7fb8dd2c1b1e75

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