okernel
Zero-dependency Python tracer with HTML visualization.
Installation
pip install okernel
Quick Start
import okernel
code = """
def factorial(n):
return 1 if n <= 1 else n * factorial(n-1)
print(factorial(5))
"""
# Generate trace and visualize
trace = okernel.trace(code)
trace.to_html("trace.html")
# Output: Generated trace.html with 24 steps
Features
- Zero external dependencies (Python stdlib only)
- Rich trace events with memory, timing, hardware costs
- 3-panel HTML visualizer:
- Code view with line highlighting
- Stack/Heap inspector
- Timeline with memory chart
- Security: No innerHTML, programmatic DOM creation
- Works offline - generates self-contained HTML files
API
okernel.trace(code: str) -> Trace
Executes code string and returns a Trace object containing execution events, memory stats, and timing data.
Trace.to_html(path: str)
Generates a self-contained HTML visualizer at the specified path.
Trace.summary() -> str
Returns a text summary of execution metrics (steps, peak memory, duration).
Trace.events
List of raw execution events (line changes, calls, returns, opcode costs).
Links
- PyPI: https://pypi.org/project/okernel/
- Website: https://okernel.dev
Release files for okernel 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| okernel-0.2.0.tar.gz | 21.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| okernel-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.4 kB
Release files / okernel-0.2.0.tar.gz
| Download URL | okernel-0.2.0.tar.gz |
|---|---|
| Size | 21.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0d13b4582b365ffd07f56f4f81fcb07d0d267eb18e1166a5e86b9f8594a5f88
|
|
BLAKE2b-256 checksum How to use checksums |
e3f9efa2b42066ac9baab6e295da605f4d6d7de7dfb9b72905bb10a25968e12d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / okernel-0.2.0-py3-none-any.whl
| Download URL | okernel-0.2.0-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
639c85db92b7fa8a8e45ef1e15b9d7263a52ee4e09deef03c057661c6e0fefca
|
|
BLAKE2b-256 checksum How to use checksums |
66a6cfed657a63f4f66c48ed66dda941fa4e721773d5c25e067ad34320b45013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|