pipen-diagram


Namepipen-diagram JSON
Version 0.13.2 PyPI version JSON
download
home_pagehttps://github.com/pwwang/pipen-diagram
SummaryDraw pipeline diagrams for pipen.
upload_time2025-07-30 00:18:42
maintainerNone
docs_urlNone
authorpwwang
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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_loglevel`: The log level of the diagram
- `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, 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.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/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pwwang/pipen-diagram",
    "name": "pipen-diagram",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "pwwang",
    "author_email": "pwwang@pwwang.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/b3/7a7371bb445f9ee11df1039142c08a7211b616e3915911316a9f54d11590/pipen_diagram-0.13.2.tar.gz",
    "platform": null,
    "description": "# pipen-diagram\n\nDraw pipeline diagrams for [pipen][1].\n\n## Features\n\n- Diagram theming\n- Hiding processes from diagram\n\n## Configurations\n\n- `diagram_theme`: The name of the theme to use, or a dict of a custom theme.\n  - See `pipen_diagram/diagram.py` for the a theme definition\n  - See [https://graphviz.org/][2] for theme items\n- `diagram_loglevel`: The log level of the diagram\n- `diagram_savedot`: Whhether to save the dot file (for debugging purpose)\n- `diagram_hide`: Process-level item, whether to hide current process from the diagram\n\n## Installation\n\n```shell\npip install -U pipen-diagram\n```\n\n## Enabling/Disabling the plugin\n\nThe plugin is registered via entrypoints. It's by default enabled. To disable it:\n`plugins=[..., \"no:diagram\"]`, or uninstall this plugin.\n\n## Usage\n\n`example.py`\n\n```python\nfrom pipen import Proc, Pipen, ProcGroup\n\n\nclass A(Proc):\n    \"\"\"Process A\"\"\"\n    input = \"a\"\n\n\nclass B(Proc):\n    \"\"\"Process B\"\"\"\n    requires = A\n    input = \"b\"\n    plugin_opts = {\"diagram_hide\": True}\n\n\nclass PG(ProcGroup):\n    \"\"\"Process Group\"\"\"\n    @ProcGroup.add_proc\n    def c(self):\n        \"\"\"Process C\"\"\"\n        class C(Proc):\n            input = \"c\"\n\n        return C\n\n    @ProcGroup.add_proc\n    def c1(self):\n        \"\"\"Process C1\"\"\"\n        class C1(Proc):\n            requires = self.c\n            input = \"c1\"\n            plugin_opts = {\"diagram_hide\": True}\n\n        return C1\n\n    @ProcGroup.add_proc\n    def d(self):\n        \"\"\"Process D\"\"\"\n        class D(Proc):\n            input = \"d\"\n            requires = self.c1\n\n        return D\n\n\npg = PG()\npg.c.requires = B\n\n\nclass E(Proc):\n    \"\"\"Process E\"\"\"\n    input = \"e1,e2\"\n    requires = pg.d, A\n\n\nclass F(Proc):\n    \"\"\"Process F\"\"\"\n    input = \"f\"\n    requires = E\n\n\nPipen(\"MyPipeline\").set_start(A).run()\n# Dark theme\n# Pipen(\"MyPipeline\", plugin_opts={\"diagram_theme\": \"dark\"}).set_start(A).run()\n```\n\nRunning `python example.py` will generate `MyPipeline-output/diagram.svg`:\n\n| Default theme | Dark theme | Fancy theme | Fancy dark theme |\n| ------------- | ---------- | ----------- | ---------------- |\n| ![diagram](./diagram.svg) | ![diagram_dark](./diagram_dark.svg) | ![diagram_fancy](./diagram_fancy.svg) | ![diagram_fancy_dark](./diagram_fancy_dark.svg) |\n\n[1]: https://github.com/pwwang/pipen\n[2]: https://graphviz.org/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Draw pipeline diagrams for pipen.",
    "version": "0.13.2",
    "project_urls": {
        "Homepage": "https://github.com/pwwang/pipen-diagram",
        "Repository": "https://github.com/pwwang/pipen-diagram"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aeb045f40b64712e01a3e8b395417996e11c9012f4e490aaa0e44b13c13d8e12",
                "md5": "f8edf90799206bd6e0c58c50898647eb",
                "sha256": "67a29474b5661848df3618b682fffeafeebcefeec1678a8754207aaa8a6f96c3"
            },
            "downloads": -1,
            "filename": "pipen_diagram-0.13.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f8edf90799206bd6e0c58c50898647eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 6300,
            "upload_time": "2025-07-30T00:18:41",
            "upload_time_iso_8601": "2025-07-30T00:18:41.796071Z",
            "url": "https://files.pythonhosted.org/packages/ae/b0/45f40b64712e01a3e8b395417996e11c9012f4e490aaa0e44b13c13d8e12/pipen_diagram-0.13.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cb37a7371bb445f9ee11df1039142c08a7211b616e3915911316a9f54d11590",
                "md5": "716163e5ccebc18d5e0f0016ac089f88",
                "sha256": "fae6964deb7d6a3fb3a2b21f3cf295c5a039fbc3d5cb544c9076531fb8e4e4a7"
            },
            "downloads": -1,
            "filename": "pipen_diagram-0.13.2.tar.gz",
            "has_sig": false,
            "md5_digest": "716163e5ccebc18d5e0f0016ac089f88",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 5950,
            "upload_time": "2025-07-30T00:18:42",
            "upload_time_iso_8601": "2025-07-30T00:18:42.845305Z",
            "url": "https://files.pythonhosted.org/packages/5c/b3/7a7371bb445f9ee11df1039142c08a7211b616e3915911316a9f54d11590/pipen_diagram-0.13.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-30 00:18:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pwwang",
    "github_project": "pipen-diagram",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pipen-diagram"
}
        
Elapsed time: 3.97298s