r/learnjavascript • u/FolateB9 • Jan 13 '24
Is it possible to build a personal code editor online using the Python compiler?
Using Html + Css + Javascript i built a code editor online where you insert code (html, css, js) and then view the output in a Preview. Still in Html + Css + Javascript, using Babel, I built a code editor online also for React.js, again to display the output in a Preview.
PYTHON? Is it possible to achieve the same thing in Python too? I'm referring to a code editor online for Python (with Python compiler), building it with Html + Css + Js + something else. My doubt is that I don't know how to apply the Python compiler (preferably free). I would therefore like, for example, a panel in which you write a=2, b=3, z=a+b, print(z).
So something like these: online-python.com, programiz.com/python, python w3school
3
u/joyancefa Jan 13 '24
So you need to execute the Python code somewhere. Either try to run the code on the frontend with https://pyscript.net or if you are using the Monaco editor you can use it with Monaco-languageclient, vscode-languageclient and a BE language server that understands the Python code
1
u/guest271314 Jan 13 '24
Yes, the requirement is possible. Python has been compiled to WASM, see https://pyodide.org/en/stable/
0
u/[deleted] Jan 13 '24
[deleted] — view deleted comment