Skip to main content

CodeJourney

CodeJourney is an educational Python execution visualizer for Jupyter notebooks. It helps beginners inspect source-line execution, variable changes, collections, aliases, loop iterations, condition previews, and recognizable learning hazards.

Motivation

Beginners often have to infer program behavior by repeatedly comparing source code with the current values of variables. Traditional line-by-line traces can also lose the structure of loops. CodeJourney presents captured execution steps as a navigable notebook view, with variable diffs and loop-aware landmarks intended to make common patterns easier to inspect.

CodeJourney is a learning aid, not a replacement for a debugger or a complete model of Python execution.

Verified features

The following features are present in the current implementation and reviewed against the repository source:

  • run_viz(code_str, *, max_steps=500) returns structured trace data.
  • %%pyviz runs a Python cell and displays the resulting trace in IPython or Jupyter.
  • Standard output is captured as execution proceeds and shown in an Output card that follows the selected trace step, rather than as separate notebook cell output.
  • Captured trace events include source lines, variable snapshots, variable diffs, collection mutations, and runtime or syntax errors.
  • Supported loop metadata includes for, while, nested loops, iteration boundaries, and known totals when they can be established from source.
  • Safe condition previews show short-circuit evaluation order for supported and/or operands, including expressions Python skips.
  • Supported conditional statments metadata will be visualized and have the evaluated expression, subsitutes values, and whether the condition evaluates to True or False
  • Shared object identity is rendered as alias links rather than inferred from equal values.
  • The HTML view is CSS-only and is intended to work in notebook renderers that restrict JavaScript.
  • The implementation includes educational prompts for supported, recognizable cases such as list mutation during iteration, first-iteration break or return, and assignment to a Python built-in name.

These source-level and unit-test features have not been marked manually verified unless they are personally confirmed by the repository maintainer. Use the manual test checklist for notebook and fresh-install verification.

Requirements

  • Python 3.9 or newer.
  • Jupyter/IPython for notebook display and %%pyviz.
  • The run_viz API can be used in Python environments with or without IPython.

Installation

From PyPI

CodeJourney is published on PyPI

python -m pip install codejourney

PyPI package: https://pypi.org/project/codejourney/ After installation, restart the Jupyter kernel before importing the package

Development installation

From the repository root:

python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
# source .venv/bin/activate

python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install pytest

Run the existing test suite with:

python -m pytest

The test command verifies repository automation, but it does not replace personal review of the interactive notebook UI.

Quick start: run_viz

Install the published package from PyPI with:

pip install codejourney
from codejourney import run_viz

trace = run_viz(
    "total = 0\n"
    "for number in [1, 2, 3]:\n"
    "    total += number\n",
    max_steps=100,
)

trace.events
trace.error
trace.warnings
trace._repr_html_()

In a Jupyter notebook, displaying trace may render the interactive HTML:

trace

max_steps must be a positive integer and defaults to 500.

Quick start: %%pyviz

Import codejourney in an active IPython/Jupyter session to register the %%pyviz cell magic automatically:

import codejourney

Then run a source cell:

%%pyviz
total = 0
for number in [1, 2, 3]:
    total += number

The magic returns a TraceResult; outside a live IPython environment, use run_viz instead.

Visualization controls

The notebook view provides the following controls:

  • Timeline ticks — select an execution step directly.
  • END — select the final execution state; it follows the numbered steps.
  • Prev — move to the previous captured execution step.
  • Next — move to the next captured execution step.
  • Prev Iteration — move to the previous loop-start boundary.
  • Next Iteration — move to the next loop-start boundary.
  • Jump to Next Change — move to the next later step that reports a variable diff.
  • Step counter — show the selected step and total number of captured steps.
  • Output — show accumulated standard output through the selected state.
  • Source panel — highlight the source line associated with the selected execution state.
  • Variables — show variable names and scalar or collection values captured at that state.
  • Objects — show object or collection representations and links from object-valued variables.
  • What changed? — show added, removed, or modified variables and, when available, affected list indices or dictionary keys.
  • Learning notes — show supported educational warnings, execution errors from the step where they occur onward, and trace-limit truncation notices.
  • Iteration badge — show loop iteration context when available.

Controls disabled for the current step or state are shown as unavailable.

Supported scope

CodeJourney can inspect and visualize:

  • Python source supplied as a string to run_viz, or a complete cell passed to %%pyviz.
  • Supported built-in scalar values and nested built-in collections.
  • Observed line, return, and exception trace events.
  • for and while loop structure and source-expressed condition metadata.
  • Syntax and runtime errors, with partial results where execution already produced trace events.

Support is deliberately bounded. CodeJourney does not trace every construct, native operation, extension call, generator, or third-party library behavior in full. It does not promise complete support for every Python program or every possible exception.

Security warning

Executed code is not sandboxed. run_viz and %%pyviz execute submitted code with the permissions of the current Python process. Analyzed code can perform file or network I/O, invoke native code, consume resources, or block. Only run code you trust and review it before execution.

max_steps limits traced Python line events. It is not a timeout and is not a security boundary. Execution can continue beyond the trace limit for behavior that does not produce further counted events.

Limitations

  • This is an educational execution trace, not a full debugger.
  • It does not provide breakpoints or control of a live process.
  • Captured values and object displays are snapshots, not live variable references.
  • Unsupported values receive safe type-oriented descriptions rather than arbitrary representations.
  • Aliases are based on observed shared object identity.
  • Arbitrary condition expressions are not re-evaluated for display; short-circuit sub-expressions are previewed only when they use supported constants, captured scalar values, and comparisons.
  • Loop totals may be unknown for dynamic iterables or while loops.
  • A reached step limit produces a partial visualization and warning.
  • Syntax and runtime errors are represented alongside available partial data; they should not be interpreted as successful completion.
  • Snapshot depth and trace behavior may omit or summarize deeply nested or uncommon values.
  • Learning warnings are prompts, not proofs of an error or defect.

Comparison with existing execution visualizers

CodeJourney overlaps with existing execution visualizers, including browser and notebook tools such as Python Tutor, but has a narrower educational focus. The current implementation emphasizes loop iteration landmarks, variable diffs, collection mutation details, aliases, condition previews, and recognizable beginner warnings.

Python Tutor and other established tools may provide broader compatibility, longer-lived ecosystems, or additional debugger-style features. CodeJourney does not claim to be better than those tools, the first execution visualizer, or a general replacement for an IDE debugger.

Choose the tool appropriate to the program and learning task. CodeJourney is most useful for short, reviewable Python examples in Jupyter.

Team

  • Eric Yiu
  • Yuen Cheng
  • Jason Lai

License

Repository metadata currently declares MIT. A separate license file or official release wording has not been provided here as a completed claim: [License text and link placeholder].

Version

Current release: 0.2.4

The project specification is available in SPEC.md.

Metadata

Release files for codejourney 0.2.4

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

Source distribution (sdist)

Source distribution for codejourney 0.2.4
File Size Uploaded Provenance Actions
codejourney-0.2.4.tar.gz 33.8 kB With provenance Details for codejourney-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 57.6 kB

Release files / codejourney-0.2.4.tar.gz

Download URL codejourney-0.2.4.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
891b6c629e370180e943fa364b7921b9d80b102b6a297a3be93a4233dbfeaf61
BLAKE2b-256 checksum
How to use checksums
26a410cfa2c92923d6272c3cedadaa629a0f5def8ad3c0972e531a876fb2b253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Release files / codejourney-0.2.4-py3-none-any.whl

Download URL codejourney-0.2.4-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37b81fb78b065a54e55a80448d16ca6a889fedb276739dea43389cd576097329
BLAKE2b-256 checksum
How to use checksums
fb41e124e3dd9b86a623ae5345a993ef87d262a54e36d66c275bf6ba8474aec6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Security for codejourney 0.2.4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codejourney-0.2.4.tar.gz

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 Nov 23, 2026.

Transparency log

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