acos-jsvee-transpiler-python

raw JSON →
0.3.8 verified Fri May 01 auth: no javascript maintenance

Transpiler that converts Python 3 code into the format expected by Jsvee for visual execution. Current stable version 0.3.8, maintenance mode with limited updates. Designed for the ACOS server ecosystem, requiring peer dependencies acos-jsvee (~0.2.0), acos-jsvee-python (~0.2.0), and acos-kelmu (~0.1.0). Supports a restricted subset of Python constructs; not a general-purpose transpiler. Lower-level integration point for ACOS-based teaching tools.

error SyntaxError: invalid syntax at line 1
cause Unsupported Python construct used.
fix
Simplify Python code to use only supported constructs (for, while, if, def, assignments, basic expressions).
error IndentationError: unexpected indent
cause Inconsistent indentation in source Python string.
fix
Tidy indentation to 4 spaces throughout the Python code block.
error Cannot find module 'acos-jsvee'
cause Missing peer dependency acos-jsvee.
fix
Install required peer dependencies: npm install acos-jsvee acos-jsvee-python acos-kelmu
breaking Only supports a limited subset of Python 3 constructs. Unsupported syntax like list comprehensions, lambdas, or async/await will throw an error.
fix Refactor Python code to use only supported constructs: basic loops, conditionals, function definitions, and simple expressions.
gotcha Indentation errors in input Python code cause silent failures or incorrect output.
fix Ensure all Python code passed to transpile() is syntactically valid with consistent indentation.
deprecated This package is in maintenance mode; no new features or Python version updates are planned.
fix Consider using Jsvee's native Python support or an alternative visualization library.
npm install acos-jsvee-transpiler-python
yarn add acos-jsvee-transpiler-python
pnpm add acos-jsvee-transpiler-python

Transpiles a simple Python for-loop into Jsvee-compatible format and prepares visualization.

import { transpile } from 'acos-jsvee-transpiler-python';
import { Jsvee } from 'acos-jsvee';

const code = `
for i in range(5):
    print(i)
`;

try {
  const jsveeFormat = transpile(code);
  console.log('Transpiled code:', jsveeFormat);
  // Then use Jsvee to render
  const visualizer = new Jsvee();
  visualizer.load(jsveeFormat);
} catch (err) {
  console.error('Transpilation failed:', err.message);
}