Skip to main content

predictygraph

Predictable graphs. A readable diagram DSL with per-group layouts ("balancing styles"), plain-CSS styling, and static or animated SVG/APNG output (no browser). Spec: docs/SPEC.md. Docs: predictygraph.github.io. Editor support: tree-sitter-pdg. In the browser: predictygraph-js. Rendered examples and the gallery: predictygraph.github.io. This repo keeps only .pdg sources; images live in the docs repo (git-lfs).

Install

uv tool install "predictygraph[apng]"    # or: pipx install "predictygraph[apng]"

[apng] adds PNG output. pdg is the short alias of the predictygraph command.

Use

pdg examples/annotations.pdg                     # -> examples/annotations.svg (not committed)
pdg diagram.pdg --css theme.css -o out.svg
pdg diagram.pdg -o out.png                       # PNG (animated if the diagram moves)
pdg diagram.pdg --check                          # validate only
pdg diagram.pdg -o d.png --width 1000 --colors 64   # small PNG for chat
pdg diagram.pdg --target web                     # size labels to fit any browser font

From a checkout, prefix these with uv run. Start with examples/annotations.pdg: one small diagram that uses every annotation feature, with a comment for each.

Agent skill

skills/predictygraph teaches an AI agent to write, render and check .pdg diagrams.

# Hermes Agent
hermes skills install https://raw.githubusercontent.com/predictygraph/predictygraph/master/skills/predictygraph/SKILL.md
# Claude Code and other agents that read SKILL.md folders: copy the folder
cp -r skills/predictygraph ~/.claude/skills/

Credits

This project stands on the shoulders of two giants.

Graphviz (dot) taught a generation that diagrams can be text. Its layered layout algorithm is still the reference for graph drawing, and we are grateful for decades of work on it. But dot optimises for the whole graph at once: you describe nodes and edges, and the engine decides where they go. Nudging one cluster without disturbing the rest means fighting rank, weight and invisible edges. Styling lives in attributes rather than CSS, and the output often looks like a paper figure rather than a slide.

Mermaid made text diagrams mainstream by putting them in Markdown, READMEs and docs sites. Its syntax is friendly and we borrowed from its spirit. But it renders through a browser and JavaScript, leaves little control over layout, and the same source can render differently across versions and hosts.

predictygraph keeps what we love from both (diagrams as readable text) and adds what we missed: per-group layouts, plain-CSS styling, and deterministic static SVG with no browser in the loop.

License

Apache-2.0, see LICENSE. Forks must keep NOTICE. Bundled fonts keep their own licences in fonts/licenses.

Metadata

Release files for predictygraph 0.6.0

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

Source distribution (sdist)

Source distribution for predictygraph 0.6.0
File Size Uploaded Provenance Actions
predictygraph-0.6.0.tar.gz 163.3 kB Without provenance Details for predictygraph-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for predictygraph 0.6.0
File Interpreter ABI Platform Actions
predictygraph-0.6.0-py3-none-any.whl Python 3 none any Details for predictygraph-0.6.0-py3-none-any.whl

Total release size: 335.0 kB

Release files / predictygraph-0.6.0.tar.gz

Download URL predictygraph-0.6.0.tar.gz
Size 163.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3b949c710968c7f7d4c6a645720ba9ef76540958416e3a621b0ebe39f31c00b3
BLAKE2b-256 checksum
How to use checksums
b70d8bb7a4a56236aec31a6e403161957f8ef9297c6d542ea673752f8fc19d76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / predictygraph-0.6.0-py3-none-any.whl

Download URL predictygraph-0.6.0-py3-none-any.whl
Size 171.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8502af965a59ac01d04d6c04fd4a22f0eb39da95ebb0046f096c20f78e13bae9
BLAKE2b-256 checksum
How to use checksums
3fb65b8ed5b3b4fdde8b6781ff12af7c6d963e4d0b3cf45acdde0a6ee0cf413d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for predictygraph 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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