Skip to main content
spaday-dagre logo, a layered directed graph inside a browser window

dagre graph rendering for spaday

Build Status codecov License PyPI

Overview

spaday-dagre renders directed graphs in spaday from a serializable node/edge config, laid out by @dagrejs/dagre and drawn as light-DOM SVG. Colors ride the spaday shell's --spa-* tokens, so bind_root_class("wa-dark", ...) re-themes the graph with the rest of the page, and application CSS reaches every shape. dagre-node-click bubbles the node id (scalar detail, so SetField("selected", event_value()) just works); dagre-edge-click bubbles {source, target}.

Quick example

from spaday import element
from spaday.backends.starlette import serve
from spaday_dagre import Dagre, package

graph = Dagre(
    graph={
        "nodes": [{"id": "a", "label": "Alpha"}, {"id": "b"}],
        "edges": [{"source": "a", "target": "b", "label": "flow"}],
    },
    layout={"rankdir": "LR"},
)
app = serve(element("main").child(graph), packages=[package])

Node sizes default from label measurement; per-node width/height/class and per-edge label/class override. layout passes through to dagre (rankdir, align, nodesep, ranksep, edgesep, marginx/marginy, ranker). Installing the package registers the dagre entry point, so packages=["dagre"] also works.

Run the local example

python -m spaday_dagre.example

Open http://127.0.0.1:8016: a pipeline DAG with direction switching, node selection, and the dark-mode toggle.

[!NOTE] This library was generated using copier from the Base Python Project Template repository.

Metadata

Release files for spaday-dagre 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spaday-dagre 0.1.1
File Size Uploaded
spaday_dagre-0.1.1.tar.gz 160.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spaday-dagre 0.1.1
File Interpreter ABI Platform
spaday_dagre-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 279.0 kB

Release files / spaday_dagre-0.1.1.tar.gz

Download URL spaday_dagre-0.1.1.tar.gz
Size 160.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0fe888b18502c10e5d189c9ea219eb109266e83c99f0680a20a2b6ad7e609d35
BLAKE2b-256 checksum
How to use checksums
e3a7e216fb453093b822de269d6ec0c088913d0859a20c264e3155d9d4b93793
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / spaday_dagre-0.1.1-py3-none-any.whl

Download URL spaday_dagre-0.1.1-py3-none-any.whl
Size 118.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1b37dabd8304b512089557c0b044f5fa079f95927ab78b19cf31ec1a6a2da1a
BLAKE2b-256 checksum
How to use checksums
2754fb08d907852babf0125e9909313c159d153c2a0a5121f9b8f735eae98ddd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page