Metadata-Version: 2.1
Name: pipen-diagram
Version: 0.1.0
Summary: Draw pipeline diagrams for pipen.
Home-page: https://github.com/pwwang/pipen-diagram
License: MIT
Author: pwwang
Author-email: pwwang@pwwang.com
Requires-Python: >=3.7.1,<4.0.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: graphviz (<1.0.0)
Requires-Dist: pipen (>=0.3,<0.4)
Project-URL: Repository, https://github.com/pwwang/pipen-diagram
Description-Content-Type: text/markdown

# pipen-diagram

Draw pipeline diagrams for [pipen][1].

## Features

- Different coloring for different roles of processes (start, end, etc)
- 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
- `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`
```python
from pipen import Proc, Pipen

class Process(Proc):
    input = 'a'
    output = 'b:{{in.a}}'

class P1(Process):
    input_data = [1]

class P2(Process):
    requires = P1

class P3(Process):
    requires = P2
    plugin_opts = {"diagram_hide": True}

class P4(Process):
    requires = P3

Pipen().run(P1)
```

Running `python example.py` will generate `pipen-0_results/diagram.svg`:

![diagram](./diagram.png)

[1]: https://github.com/pwwang/pipen

