Skip to main content

Draw pipeline diagrams for pipen.

Project description

pipen-diagram

Draw pipeline diagrams for pipen.

Features

  • Diagram theming
  • Hiding processes from diagram

Configurations

  • diagram_theme: The name of the theme to use, or a dict of a custom theme.
  • diagram_savedot: Whhether to save the dot file (for debugging purpose)
  • diagram_hide: Process-level item, whether to hide current process from the diagram

Installation

pip install -U pipen-diagram

Enabling/Disabling the plugin

The plugin is registered via entrypoints. It's by default enabled. To disable it: plugins=[..., "no:diagram"], or uninstall this plugin.

Usage

example.py

from pipen import Proc, Pipen, ProcGroup


class A(Proc):
    """Process A"""
    input = "a"


class B(Proc):
    """Process B"""
    requires = A
    input = "b"
    plugin_opts = {"diagram_hide": True}


class PG(ProcGroup):
    """Process Group"""
    @ProcGroup.add_proc
    def c(self):
        """Process C"""
        class C(Proc):
            input = "c"

        return C

    @ProcGroup.add_proc
    def c1(self):
        """Process C1"""
        class C1(Proc):
            requires = self.c
            input = "c1"
            plugin_opts = {"diagram_hide": True}

        return C1

    @ProcGroup.add_proc
    def d(self):
        """Process D"""
        class D(Proc):
            input = "d"
            requires = self.c1

        return D


pg = PG()
pg.c.requires = B


class E(Proc):
    """Process E"""
    input = "e1,e2"
    requires = pg.d, A


class F(Proc):
    """Process F"""
    input = "f"
    requires = E


Pipen("MyPipeline").set_start(A).run()
# Dark theme
# Pipen("MyPipeline", plugin_opts={"diagram_theme": "dark"}).set_start(A).run()

Running python example.py will generate MyPipeline-output/diagram.svg:

Default theme Dark theme Fancy theme Fancy dark theme
diagram diagram_dark diagram_fancy diagram_fancy_dark

Project details


Download files

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

Source Distribution

pipen_diagram-0.12.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

pipen_diagram-0.12.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file pipen_diagram-0.12.0.tar.gz.

File metadata

  • Download URL: pipen_diagram-0.12.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1023-azure

File hashes

Hashes for pipen_diagram-0.12.0.tar.gz
Algorithm Hash digest
SHA256 deb03e8e674c11b3b970655e7872bb8006cb4406caf63069dce013cdb86ec1f4
MD5 a6cf38473a5bbef95bdb99309e31df6e
BLAKE2b-256 3212e543804f50dc1bcc6741a28f4d13abdc433114b705c4507a241db8c5110e

See more details on using hashes here.

File details

Details for the file pipen_diagram-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: pipen_diagram-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1023-azure

File hashes

Hashes for pipen_diagram-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca208c8968b09dd29ccdea1ea3334b4494d971b2714f89165df78687fea31525
MD5 a49e8dea4dc5247724be55ce22c6dd85
BLAKE2b-256 8d0b591c43d7c5dd976a0e33cde4522cd0bbdc80e8b56b69eeea4c80491cf0b8

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