Skip to main content

Q-Alchemy Visualization

q-alchemy-visualization provides a small, renderer-neutral model for experiment flow diagrams, plus text and Matplotlib renderers. It is designed for reports produced by Q-Alchemy libraries, but the diagram model can be used independently.

The package contains no service client, credentials, feasibility decisions, or quantum execution logic. Text rendering has no runtime dependencies. Matplotlib is optional and imported only when graphical output is requested.

Project status: Alpha. The versioned wire format is stable within schema version 1, but renderer features may expand in later releases.

Installation

Install the dependency-free text renderer from PyPI:

python -m pip install q-alchemy-visualization

Install graphical rendering support with:

python -m pip install "q-alchemy-visualization[mpl]"

Python 3.11 and newer are supported.

Quick start

from q_alchemy.visualization import (
    ExperimentConnection,
    ExperimentDiagram,
    ExperimentStep,
    ExperimentStepStatus,
)

diagram = ExperimentDiagram(
    title="EXPERIMENT EXECUTION",
    steps=(
        ExperimentStep("PREPARE", status=ExperimentStepStatus.RUN, key="prepare"),
        ExperimentStep(
            "CLASSICAL",
            details=("Assessment: feasible",),
            status=ExperimentStepStatus.RUN,
            key="classical",
        ),
        ExperimentStep(
            "QUANTUM",
            details=("Assessment: compared",),
            status=ExperimentStepStatus.RUN,
            key="quantum",
        ),
    ),
    connections=(
        ExperimentConnection("prepare", "classical"),
        ExperimentConnection("classical", "quantum"),
    ),
)

print(diagram.draw(output="text", show_title=True))

# Requires the `mpl` extra. The caller owns the returned Figure.
figure = diagram.draw(output="mpl", show_title=True)
figure.savefig("experiment.png", bbox_inches="tight")

Wire format

Diagrams serialize to a versioned JSON-compatible representation so producers and renderers do not need to share workflow-specific code:

payload = diagram.to_dict()
restored = ExperimentDiagram.from_dict(payload)

encoded = diagram.to_json(indent=2)
restored_from_json = ExperimentDiagram.from_json(encoded)

Schema version 1 uses this structure:

{
  "schema_version": 1,
  "kind": "experiment-diagram",
  "title": "EXPERIMENT EXECUTION",
  "nodes": [
    {
      "id": "classical",
      "title": "CLASSICAL",
      "details": ["Assessment: feasible"],
      "status": "run"
    }
  ],
  "edges": []
}

The wire representation contains no renderer coordinates, Matplotlib objects, ASCII layout, or Q-Alchemy feasibility rules. Explicit connections must form a directed acyclic graph. The current compact text layout supports at most two nodes per layer and connections between adjacent layers.

Titles are hidden by default. Pass show_title=True to either renderer to show the diagram title.

Public API

The top-level package exports:

  • ExperimentDiagram
  • ExperimentStep
  • ExperimentStepStatus
  • ExperimentConnection
  • TextExperimentDrawer
  • MatplotlibExperimentDrawer
  • DIAGRAM_SCHEMA_VERSION

Development

Clone the repository, create an environment, and run the tests:

python -m venv .venv
.venv/bin/python -m pip install -e ".[dev]"
.venv/bin/python -m pytest

Build and validate the distributions before proposing a release:

.venv/bin/python -m build
.venv/bin/python -m twine check dist/*

See CONTRIBUTING.md for contribution and release guidance.

License

Licensed under the Apache License 2.0.

Release files for q-alchemy-visualization 0.1.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 q-alchemy-visualization 0.1.0
File Size Uploaded
q_alchemy_visualization-0.1.0.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for q-alchemy-visualization 0.1.0
File Interpreter ABI Platform
q_alchemy_visualization-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.5 kB

Release files / q_alchemy_visualization-0.1.0.tar.gz

Download URL q_alchemy_visualization-0.1.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f1b57558fdd3152e422a356c1129767744616b954fb6ee43273648208babbe9c
BLAKE2b-256 checksum
How to use checksums
fbee82232b3f24d351f55cc3983bc650d95b3d1a3eba05cd95377299a704066f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / q_alchemy_visualization-0.1.0-py3-none-any.whl

Download URL q_alchemy_visualization-0.1.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54bd8ab5192b16bf690eb0e1a59c1fd5877e9d3d5b5a96729c764433db766bf4
BLAKE2b-256 checksum
How to use checksums
afa40604b00486bf951c639e929ab8a60185bc2eb5ef3ca4a4bfc9ec673667d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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