Skip to main content

florajs

Beautiful, interactive diagrams from Mermaid-compatible syntax — the Python interface to Flora.

  • Jupyter-native: diagrams display interactively (zoom, pan, hover highlighting, click links) right in the notebook.
  • Headless SVG export: to_svg() runs the Flora renderer in an embedded V8 engine — no browser, no Node.js.
  • Two ways in: a programmatic builder, or raw Flora/Mermaid syntax.
pip install florajs

Quick start

from florajs import Flowchart

fc = Flowchart("LR", theme="tufte")
fc.node("raw", "Raw events", shape="cylinder")
fc.node("clean", "Cleaned", shape="stadium")
fc.edge("raw", "clean", "dbt run")
fc  # displays interactively in Jupyter

Or from raw Flora/Mermaid syntax:

from florajs import Diagram

d = Diagram("""
flowchart TD
  a[Start] --> b{Decide}
  b -->|yes| c([Done])
  b -->|no| a
""", theme="sketch")
d.to_svg_file("decision.svg")

Building diagrams

fc = Flowchart("TD")                       # TB | TD | BT | LR | RL

fc.node("a", "Label", shape="diamond")     # rect | rounded | circle | diamond
                                           # stadium | cylinder | queue
fc.edge("a", "b", "maybe",                 # optional edge label
        style="dotted",                    # solid | dotted | thick
        arrow="bidirectional")             # arrow | open | bidirectional

with fc.subgraph("Ingest"):                # groups nest
    fc.node("api", "API")
    fc.node("queue", "Queue", shape="queue")

fc.link("api", "https://example.com/api",  # click-through links
        tooltip="API docs", target="_blank")

Every builder method chains: fc.node("a").edge("a", "b").

Rendering

Method Output
to_svg() SVG string (headless, no browser needed)
to_svg_file(path) SVG file
to_html() standalone interactive HTML document
to_html_file(path) standalone interactive HTML file
_repr_html_ automatic interactive display in Jupyter
source the generated Flora syntax
warnings parser diagnostics

Themes

Presets: default, tufte, digital, sketch. Or pass a dict of theme overrides:

Diagram(src, theme={"background": "#0b1021", "fontSize": 13})

Errors you can trust

Flora never renders silently wrong output. Lines that cannot be parsed are skipped and reported as a FloraSyntaxWarning; pass strict=True to raise FloraParseError instead:

Diagram(src, strict=True).to_svg()  # raises FloraParseError on any skipped line

Development

The package embeds a JS bundle built from the repository root:

npm run build:python        # builds and vendors flora.iife.js
cd python
pip install -e ".[dev]"
pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

florajs-0.1.2.tar.gz (41.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

florajs-0.1.2-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file florajs-0.1.2.tar.gz.

File metadata

  • Download URL: florajs-0.1.2.tar.gz
  • Upload date:
  • Size: 41.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for florajs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 33994d54b0d24b8d869635c7657ccc2cbdcc7f73d07a64497db47f70d4c4b333
MD5 bb44fe5aaf9d18df3e86b4488e6d7ae4
BLAKE2b-256 a527f89609373d1c4977a8c46655cc325e9f07a1bb2a81f038719dd4d12e981f

See more details on using hashes here.

Provenance

The following attestation bundles were made for florajs-0.1.2.tar.gz:

Publisher: python-publish.yml on topspinj/florajs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file florajs-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: florajs-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for florajs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4008c089fc48ad222a3e07259a4d479cb2e7ae4a24268af3ab4705add5e132de
MD5 658e3446da17729cdfcb17064d05a9fc
BLAKE2b-256 770af05f76791408796e5635882345544cbf800b83cdc35dbf43bcf35ec5b7f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for florajs-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on topspinj/florajs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page