Skip to content

Getting Started — Python Package

The eigenvue Python package lets you launch the same interactive visualizations you see on eigenvue.web.app — directly from your terminal, scripts, or notebooks.

Install from PyPI:

Terminal window
pip install eigenvue

Requirements:

  • Python 3.10 or later
  • The only runtime dependency is Flask, which is installed automatically

Verify the installation:

import eigenvue
print(eigenvue.__version__)

Use eigenvue.list() to see every algorithm the package ships with:

import eigenvue
algorithms = eigenvue.list()
for algo in algorithms:
print(f"{algo.id:30s} {algo.category:20s} {algo.name}")

list() returns a list of AlgorithmInfo objects — frozen dataclasses, so read their fields with attribute access rather than subscripting. Each one carries id, name, category, description, difficulty, time_complexity and space_complexity.

category is one of "classical", "deep-learning", "generative-ai" or "quantum", and list() accepts one to filter by:

classical = eigenvue.list(category="classical")

Call eigenvue.show() with an algorithm ID to launch the visualizer in your default browser:

import eigenvue
eigenvue.show("bubble-sort", inputs={"array": [5, 3, 8, 1, 2]})

A local Flask server starts in the background and serves the interactive three-panel visualizer. The browser tab opens automatically. Press Ctrl+C in the terminal to stop the server when you are done.

Custom inputs go in the inputs dictionary, and its keys are the parameter names that algorithm declares — array for the sorting algorithms, array and target for binary search, and so on. Each algorithm’s reference page lists its parameters, and eigenvue.list() is the quickest way to find an algorithm’s ID. Omit inputs entirely to use the algorithm’s defaults.

Inputs are checked against the algorithm’s schema before anything runs, so a misspelled parameter or an out-of-range value raises ValueError describing exactly what was wrong rather than producing a misleading visualization. See Input Validation.

When you need raw step data — for analysis, testing, or integration with other tools — use eigenvue.steps():

import eigenvue
steps = eigenvue.steps("binary-search", inputs={"array": [1, 3, 5, 7, 9], "target": 7})
print(f"Total steps: {len(steps)}")
for step in steps:
print(f"Step {step['index']}: {step['title']}")
print(f" {step['explanation']}")
print(f" State: {step['state']}")

steps() returns a list of step dictionaries in the step format, with camelCase keys for JSON compatibility. The keys you will use most often:

KeyTypeDescription
indexintPosition in the sequence, starting at 0
idstrStable identifier for this kind of step, e.g. "calculate_mid"
titlestrShort heading for the step
explanationstrPlain-language description of what just happened
statedictSnapshot of the algorithm’s variables at this point
codeHighlightdict{"language": str, "lines": list[int]} — the lines to highlight
isTerminalboolTrue only for the final step

Steps also carry visualActions and an optional phase. The list is never empty, and only the last entry has isTerminal set.

This makes it straightforward to write assertions in tests, collect metrics, or feed step data into your own visualisation pipeline.

The package ships with a py.typed marker and full type hints on every public function. If you use a type checker such as mypy or Pyright, you get autocompletion and static analysis out of the box:

# Your editor will infer the return type automatically.
steps: list[dict[str, object]] = eigenvue.steps("merge-sort", inputs={"array": [9, 4, 7]})

Type stubs are bundled inside the package — no extra install is required.