Transpile Py to JS without running the code
See original GitHub issueIs there a function in this library that can be called to transpile, but not run, some python code? The docs mention how the compiler works behind the scenes, but I haven’t been able to figure out how to replicate that process in order to avoid the eval
called by brython
.
Sorry if this is a silly question.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Why not transpile python to JS instead of running an interpreter?
I think there are people who write sort of syntax-y transpilers, but that's not really going to lead you down to nice code...
Read more >Transcrypt - Python in the browser - Lean, fast, open!
The Transcrypt Python to JavaScript compiler makes it possible to program lean and fast browser applications in Python. Transcrypt applications can use any ......
Read more >Transcrypt without java? - python - Stack Overflow
You can now compile without minification, so without Java by using the -n switch. So, try transcrypt -n hello.
Read more >How to convert Python to JavaScript (and back again)
Before you dive in and start converting all of OpenStack to JavaScript, take heed: Jiphy is not about full-blown codebase conversion. Rather, ...
Read more >TypeScript Compiling with Visual Studio Code
TypeScript is a typed superset of JavaScript that transpiles to plain ... select the Run Build Task command or press (Ctrl+Shift+B), you are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In commit 346e87e910da66e870db94cf4e6506f2047a3a2a I have removed
run_from_js
and addedpython_to_js(src[, script_id])
which returns Javascript code ready to be eval’ed in a JS program.It can run things like:
Sorry, I misunderstood your request.
In the commit referenced above I have added a function
__BRYTHON__.run_from_js(python_source[, script_id])
, meant to execute Python from a Javascript program.script_id
is the identifier of the Python program, defaulting to"__main__"
.If it’s what you expect, can you try it with a few examples ? If it’s ok I will document it.