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.- See
pipen_diagram/diagram.py
for the a theme definition - See https://graphviz.org/ for theme items
- See
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 |
---|---|---|---|
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_diagram-0.9.0.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file pipen_diagram-0.9.0.tar.gz
.
File metadata
- Download URL: pipen_diagram-0.9.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bf3171cd460c82fe6f2de20b21db62667d9f068dde76025d3759ff460b86e3c |
|
MD5 | b2bd800fd23beff3dc781bf0193e40db |
|
BLAKE2b-256 | c51c40c0fd099abb615e38175441c7e01245f224b30e44e4584ee6ea1ae85377 |
File details
Details for the file pipen_diagram-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: pipen_diagram-0.9.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b87fcb80b74075514127a0df5680b464aa42920a9bad3c6bd2d65b64e09f72f0 |
|
MD5 | 06a0825c412ae65e31a4d97932223736 |
|
BLAKE2b-256 | 3860bc5a04bb962ccc19112414dd544052baa0289461c6d6a45cf9212a94a5f0 |