Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pwwang/pipen-diagram
Draw pipeline diagrams for pipen.
https://github.com/pwwang/pipen-diagram
diagram flowchart pipeline pipeline-framework
Last synced: 14 days ago
JSON representation
Draw pipeline diagrams for pipen.
- Host: GitHub
- URL: https://github.com/pwwang/pipen-diagram
- Owner: pwwang
- Created: 2021-09-13T10:30:57.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T22:41:51.000Z (5 months ago)
- Last Synced: 2024-12-09T02:42:39.102Z (25 days ago)
- Topics: diagram, flowchart, pipeline, pipeline-framework
- Language: Python
- Homepage:
- Size: 358 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pipen-diagram
Draw pipeline diagrams for [pipen][1].
## 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/][2] for theme items
- `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
```shell
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`
```python
from pipen import Proc, Pipen, ProcGroupclass 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.c1return D
pg = PG()
pg.c.requires = Bclass E(Proc):
"""Process E"""
input = "e1,e2"
requires = pg.d, Aclass F(Proc):
"""Process F"""
input = "f"
requires = EPipen("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.svg) | ![diagram_dark](./diagram_dark.svg) | ![diagram_fancy](./diagram_fancy.svg) | ![diagram_fancy_dark](./diagram_fancy_dark.svg) |[1]: https://github.com/pwwang/pipen
[2]: https://graphviz.org/