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"""
class B(Proc):
"""Process B"""
requires = A
plugin_opts = {"diagram_hide": True}
class PG(ProcGroup):
"""Process Group"""
@ProcGroup.add_proc
def c(self):
"""Process C"""
class C(Proc):
...
return C
@ProcGroup.add_proc
def c1(self):
"""Process C1"""
class C1(Proc):
requires = self.c
plugin_opts = {"diagram_hide": True}
return C1
@ProcGroup.add_proc
def d(self):
"""Process D"""
class D(Proc):
requires = self.c1
return D
pg = PG()
pg.c.requires = B
class E(Proc):
"""Process E"""
requires = pg.d, A
class F(Proc):
"""Process 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_results/diagram.png
:
Default theme | 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.2.0.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for pipen_diagram-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f5326e549e022a7943e5651c845f3eee9145ed14f92bd58af5064692f50a8b3 |
|
MD5 | 5b99d813d9b539c0d631a9b3817d5d17 |
|
BLAKE2b-256 | d8067adbe5752c08f012391c6cbd187204dffdbf3c48086aa99b901ce852c4e8 |