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
Metadata
Release files for florajs 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| florajs-0.1.2.tar.gz | 41.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| florajs-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.9 kB
Release files / florajs-0.1.2.tar.gz
| Download URL | florajs-0.1.2.tar.gz |
|---|---|
| Size | 41.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33994d54b0d24b8d869635c7657ccc2cbdcc7f73d07a64497db47f70d4c4b333
|
|
BLAKE2b-256 checksum How to use checksums |
a527f89609373d1c4977a8c46655cc325e9f07a1bb2a81f038719dd4d12e981f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.
Transparency logRelease files / florajs-0.1.2-py3-none-any.whl
| Download URL | florajs-0.1.2-py3-none-any.whl |
|---|---|
| Size | 41.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4008c089fc48ad222a3e07259a4d479cb2e7ae4a24268af3ab4705add5e132de
|
|
BLAKE2b-256 checksum How to use checksums |
770af05f76791408796e5635882345544cbf800b83cdc35dbf43bcf35ec5b7f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.
Transparency log