pscript is a Python-to-JavaScript compiler that allows developers to write Python code that runs directly in a JavaScript environment, such as a web browser or Node.js. It supports converting Python functions and basic data structures into their JavaScript equivalents, enabling seamless integration of Python logic into web applications. The current version is 0.8.1, with releases occurring periodically, often tied to Python version support updates.
pip install pscriptVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a Python function decorated with `@pyscript` to automatically generate its JavaScript equivalent. The generated JavaScript source code can then be embedded and executed in a JavaScript runtime environment.
Focus on using basic Python types (strings, numbers, lists, dicts) and core operations. Avoid relying on Python-specific library functions that don't have direct JavaScript equivalents.
Test the generated JavaScript in its target environment (e.g., a web browser's console or Node.js). Do not expect browser-specific APIs to be available when inspecting the generated Python object.
Simplify function structures and explicitly pass variables where possible. Test edge cases involving closures and mutable state carefully in the JavaScript output.
No dependency data recorded yet.