how hard would it be to integrate CPython in a web browser? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: News and Discussions (https://python-forum.io/forum-31.html) +--- Thread: how hard would it be to integrate CPython in a web browser? (/thread-39442.html) |
how hard would it be to integrate CPython in a web browser? - Skaperen - Feb-19-2023 how hard would it be to integrate CPython in a web browser? how secure could be made to run? RE: how hard would it be to integrate CPython in a web browser? - snippsat - Feb-19-2023 (Feb-19-2023, 03:18 AM)Skaperen Wrote: how hard would it be to integrate CPython in a web browser? how secure could be made to run?It already done in PyScript. It's use Pyodide underneath. Quote:What is Pyodide? Just open this index.html in browser<!DOCTYPE html> <html lang="en"> <head> <script defer src="https://pyscript.net/alpha/pyscript.js"></script> </head> <body> <py-script>print("Hello, World!")</py-script> <py-script> def multiply_num(num): return num * 8 result = multiply_num(8) print(result) </py-script> </body> </html>
<head> <script defer src="https://pyscript.net/alpha/pyscript.js"></script> </head> <py-env> - numpy - matplotlib - pandas </py-env> <py-script> import pandas as pd import matplotlib.pyplot as plt import numpy as np df = pd.DataFrame(np.random.rand(10, 4), columns=["a", "b", "c", "d"]) fig, ax = plt.subplots() df.plot.area(ax=ax) plt </py-script> |