graphviz-anywidget


Namegraphviz-anywidget JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryInteractive Graphviz visualization widget for Jupyter notebooks using anywidget.
upload_time2024-11-26 01:34:36
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords graph graphviz interactive jupyter network visualization widget
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # graphviz-anywidget

[![PyPI version](https://badge.fury.io/py/graphviz-anywidget.svg)](https://badge.fury.io/py/graphviz-anywidget)
[![Python Version](https://img.shields.io/pypi/pyversions/graphviz-anywidget.svg)](https://pypi.org/project/graphviz-anywidget/)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Interactive Graphviz visualization widget for Jupyter notebooks using anywidget.
Graphviz is provided via WASM ([hpcc-js-wasm](https://github.com/hpcc-systems/hpcc-js-wasm)) and the rendering is done using [graphvizsvg](https://github.com/pipefunc/graphvizsvg) and [d3-graphviz](https://github.com/magjac/d3-graphviz), inspired by the VS Code extension [Graphviz Interactive Preview](https://github.com/tintinweb/vscode-interactive-graphviz/).

https://github.com/user-attachments/assets/74cf39c5-2d64-4c98-b3ee-cf7308753da6

https://github.com/user-attachments/assets/8947dfd1-5d4a-43b9-b0c7-22cb52f72dc3

## Features

* 🎨 Interactive SVG visualization of Graphviz DOT graphs
* 🔍 Search functionality with regex support
* 🎯 Node and edge highlighting
* ↔️ Directional graph traversal
* 🔄 Zoom reset functionality
* 📱 Responsive design
* 🎨 Smooth animations and transitions
* 💻 Works in JupyterLab, Jupyter Notebook, and VS Code

## Installation

```sh
pip install graphviz-anywidget
```

or with [uv](https://github.com/astral-sh/uv):

```sh
uv add graphviz-anywidget
```

## Usage

```python
from graphviz_anywidget import graphviz_widget

# Create a widget with a DOT string
dot_source = """
digraph {
    a -> b;
    b -> c;
    c -> a;
}
"""
widget = graphviz_widget(dot_source)
widget
```

### Features

1. **Search**: Use the search box to find nodes and edges
   - Supports exact match, substring, and regex search
   - Case-sensitive option available

2. **Direction Selection**: Choose how to traverse the graph
   - Bidirectional: Show connections in both directions
   - Downstream: Show only outgoing connections
   - Upstream: Show only incoming connections
   - Single: Show only the selected node

3. **Zoom Reset**: Reset the graph to its original position and scale

## API

### graphviz_widget

```python
def graphviz_widget(dot_source: str = "digraph { a -> b; }") -> widgets.VBox:
    """Create an interactive Graphviz widget.

    Parameters
    ----------
    dot_source
        The DOT string representing the graph

    Returns
    -------
    widgets.VBox
        The widget containing the graph and controls
    """
```

## Dependencies

- anywidget
- ipywidgets
- graphvizsvg (npm package)
- d3-graphviz (npm package)
- hpcc-js-wasm (npm package)

## Development

We recommend using [uv](https://github.com/astral-sh/uv) for development.
It will automatically manage virtual environments and dependencies for you.

```sh
uv run jupyter lab example.ipynb
```

Alternatively, create and manage your own virtual environment:

```sh
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
jupyter lab example.ipynb
```

The widget front-end code bundles it's JavaScript dependencies. After setting up Python,
make sure to install these dependencies locally:

```sh
npm install
```

While developing, you can run the following in a separate terminal to automatically
rebuild JavaScript as you make changes:

```sh
npm run dev
```

Open `example.ipynb` in JupyterLab, VS Code, or your favorite editor
to start developing. Changes made in `js/` will be reflected
in the notebook.

## License

MIT

## Credits

Built with:
- [anywidget](https://github.com/manzt/anywidget)
- [graphvizsvg](https://www.npmjs.com/package/graphvizsvg)
- [d3-graphviz](https://www.npmjs.com/package/d3-graphviz)
- The WASM binary comes from [@hpcc-js/wasm](https://github.com/hpcc-systems/hpcc-js-wasm) (via `d3-graphviz`)
- Inspired by the VS Code extension [Graphviz Interactive Preview](https://github.com/tintinweb/vscode-interactive-graphviz/).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "graphviz-anywidget",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Bas Nijholt <bas@nijho.lt>",
    "keywords": "graph, graphviz, interactive, jupyter, network, visualization, widget",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/96/ea/a45042e0013accb9fa83b1f1158edbf56cf60a7bc5902126d11e6c34b6ea/graphviz_anywidget-0.3.0.tar.gz",
    "platform": null,
    "description": "# graphviz-anywidget\n\n[![PyPI version](https://badge.fury.io/py/graphviz-anywidget.svg)](https://badge.fury.io/py/graphviz-anywidget)\n[![Python Version](https://img.shields.io/pypi/pyversions/graphviz-anywidget.svg)](https://pypi.org/project/graphviz-anywidget/)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nInteractive Graphviz visualization widget for Jupyter notebooks using anywidget.\nGraphviz is provided via WASM ([hpcc-js-wasm](https://github.com/hpcc-systems/hpcc-js-wasm)) and the rendering is done using [graphvizsvg](https://github.com/pipefunc/graphvizsvg) and [d3-graphviz](https://github.com/magjac/d3-graphviz), inspired by the VS Code extension [Graphviz Interactive Preview](https://github.com/tintinweb/vscode-interactive-graphviz/).\n\nhttps://github.com/user-attachments/assets/74cf39c5-2d64-4c98-b3ee-cf7308753da6\n\nhttps://github.com/user-attachments/assets/8947dfd1-5d4a-43b9-b0c7-22cb52f72dc3\n\n## Features\n\n* \ud83c\udfa8 Interactive SVG visualization of Graphviz DOT graphs\n* \ud83d\udd0d Search functionality with regex support\n* \ud83c\udfaf Node and edge highlighting\n* \u2194\ufe0f Directional graph traversal\n* \ud83d\udd04 Zoom reset functionality\n* \ud83d\udcf1 Responsive design\n* \ud83c\udfa8 Smooth animations and transitions\n* \ud83d\udcbb Works in JupyterLab, Jupyter Notebook, and VS Code\n\n## Installation\n\n```sh\npip install graphviz-anywidget\n```\n\nor with [uv](https://github.com/astral-sh/uv):\n\n```sh\nuv add graphviz-anywidget\n```\n\n## Usage\n\n```python\nfrom graphviz_anywidget import graphviz_widget\n\n# Create a widget with a DOT string\ndot_source = \"\"\"\ndigraph {\n    a -> b;\n    b -> c;\n    c -> a;\n}\n\"\"\"\nwidget = graphviz_widget(dot_source)\nwidget\n```\n\n### Features\n\n1. **Search**: Use the search box to find nodes and edges\n   - Supports exact match, substring, and regex search\n   - Case-sensitive option available\n\n2. **Direction Selection**: Choose how to traverse the graph\n   - Bidirectional: Show connections in both directions\n   - Downstream: Show only outgoing connections\n   - Upstream: Show only incoming connections\n   - Single: Show only the selected node\n\n3. **Zoom Reset**: Reset the graph to its original position and scale\n\n## API\n\n### graphviz_widget\n\n```python\ndef graphviz_widget(dot_source: str = \"digraph { a -> b; }\") -> widgets.VBox:\n    \"\"\"Create an interactive Graphviz widget.\n\n    Parameters\n    ----------\n    dot_source\n        The DOT string representing the graph\n\n    Returns\n    -------\n    widgets.VBox\n        The widget containing the graph and controls\n    \"\"\"\n```\n\n## Dependencies\n\n- anywidget\n- ipywidgets\n- graphvizsvg (npm package)\n- d3-graphviz (npm package)\n- hpcc-js-wasm (npm package)\n\n## Development\n\nWe recommend using [uv](https://github.com/astral-sh/uv) for development.\nIt will automatically manage virtual environments and dependencies for you.\n\n```sh\nuv run jupyter lab example.ipynb\n```\n\nAlternatively, create and manage your own virtual environment:\n\n```sh\npython -m venv .venv\nsource .venv/bin/activate\npip install -e \".[dev]\"\njupyter lab example.ipynb\n```\n\nThe widget front-end code bundles it's JavaScript dependencies. After setting up Python,\nmake sure to install these dependencies locally:\n\n```sh\nnpm install\n```\n\nWhile developing, you can run the following in a separate terminal to automatically\nrebuild JavaScript as you make changes:\n\n```sh\nnpm run dev\n```\n\nOpen `example.ipynb` in JupyterLab, VS Code, or your favorite editor\nto start developing. Changes made in `js/` will be reflected\nin the notebook.\n\n## License\n\nMIT\n\n## Credits\n\nBuilt with:\n- [anywidget](https://github.com/manzt/anywidget)\n- [graphvizsvg](https://www.npmjs.com/package/graphvizsvg)\n- [d3-graphviz](https://www.npmjs.com/package/d3-graphviz)\n- The WASM binary comes from [@hpcc-js/wasm](https://github.com/hpcc-systems/hpcc-js-wasm) (via `d3-graphviz`)\n- Inspired by the VS Code extension [Graphviz Interactive Preview](https://github.com/tintinweb/vscode-interactive-graphviz/).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Interactive Graphviz visualization widget for Jupyter notebooks using anywidget.",
    "version": "0.3.0",
    "project_urls": {
        "documentation": "https://github.com/pipefunc/graphviz-anywidget",
        "homepage": "https://github.com/pipefunc/graphviz-anywidget",
        "repository": "https://github.com/pipefunc/graphviz-anywidget"
    },
    "split_keywords": [
        "graph",
        " graphviz",
        " interactive",
        " jupyter",
        " network",
        " visualization",
        " widget"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e81235e5e7a67618fe178a5a9b336ca933c7622d3fc98d04f22680386c04aa73",
                "md5": "9c32cdc7f0fd23c964657b3fdc1d4c3f",
                "sha256": "9a3482b6b0e3d7da9011b2b8b16cca005f49f4a44ab70ded80f251b67ff6019b"
            },
            "downloads": -1,
            "filename": "graphviz_anywidget-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c32cdc7f0fd23c964657b3fdc1d4c3f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 693566,
            "upload_time": "2024-11-26T01:34:34",
            "upload_time_iso_8601": "2024-11-26T01:34:34.405467Z",
            "url": "https://files.pythonhosted.org/packages/e8/12/35e5e7a67618fe178a5a9b336ca933c7622d3fc98d04f22680386c04aa73/graphviz_anywidget-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "96eaa45042e0013accb9fa83b1f1158edbf56cf60a7bc5902126d11e6c34b6ea",
                "md5": "e817bb1024cf1936c609ad9337d0c58a",
                "sha256": "136eea9e99181c1095faca239e9a89168d157b076fc33315cc2c1413417013f1"
            },
            "downloads": -1,
            "filename": "graphviz_anywidget-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e817bb1024cf1936c609ad9337d0c58a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 692163,
            "upload_time": "2024-11-26T01:34:36",
            "upload_time_iso_8601": "2024-11-26T01:34:36.423158Z",
            "url": "https://files.pythonhosted.org/packages/96/ea/a45042e0013accb9fa83b1f1158edbf56cf60a7bc5902126d11e6c34b6ea/graphviz_anywidget-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-26 01:34:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pipefunc",
    "github_project": "graphviz-anywidget",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "graphviz-anywidget"
}
        
Elapsed time: 0.35920s