Python Forum
how hard would it be to integrate CPython in a web browser?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how hard would it be to integrate CPython in a web browser?
#2
(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?
Pyodide is a port of CPython to WebAssembly/Emscripten.

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>
Output:
Hello, World! 64

<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>
[Image: naMD1O.png]
Skaperen likes this post
Reply


Messages In This Thread
RE: how hard would it be to integrate CPython in a web browser? - by snippsat - Feb-19-2023, 02:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  efficiency of CPython expression comppilation Skaperen 1 1,343 Jan-09-2022, 06:03 AM
Last Post: casevh
  CPython ruuntime codes Skaperen 2 2,189 Feb-14-2021, 08:50 PM
Last Post: Skaperen
  Guido van Rossum about starting contributing to CPython buran 0 2,356 Feb-18-2020, 04:44 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020