A new project named PyScript, built on PyIodide, runs Python in the 
browser.  It can actually run many of the most important scientific 
packages such as matplotlib, numpy, scipy, etc., and do graphics with Bokeh 
and others.  This might be an alternative route to Leo in a browser.

See PyScript home page <https://pyscript.net>, A First Look at PyScript: 
Python in the Web Browser 
<https://realpython.com/pyscript-python-in-browser/>.

I tried an example from a PyScript "Getting Started" tutorial, one that 
uses matplotlib to plot some random numbers.  I copied the code below 
verbatim into a Leo node, opened viewrendered3, and the plot rendered in 
VR3.  There was some delay while all the imported code got compiled to 
WebAssembly, downloaded, and initialized.

<html>
    <head>
      <link rel="stylesheet" 
href="https://pyscript.net/latest/pyscript.css"; />
      <script defer src="https://pyscript.net/latest/pyscript.js";></script>
    </head>

  <body>
    <h1>Let's plot random numbers</h1>
    <div id="plot"></div>
    <py-config type="json">
        {
          "packages": ["numpy", "matplotlib"]
        }
    </py-config>
    <py-script output="plot">
      import matplotlib.pyplot as plt
      import numpy as np
      x = np.random.randn(1000)
      y = np.random.randn(1000)
      fig, ax = plt.subplots()
      ax.scatter(x, y)
      fig
    </py-script>
  </body>
</html>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/0cf7ba35-a377-4555-a6ce-805eb2796533n%40googlegroups.com.

Reply via email to