PyScript Support
Description of proposed feature
Anaconda has recently launched PyScript:
PyScript is a framework that allows users to create rich Python applications in the browser using HTML's interface and the power of Pyodide, WASM, and modern web technologies. The PyScript framework provides users at every experience level with access to an expressive, easy-to-learn programming language with countless applications.
It would be nice to be able to run Manim directly in the browser, though this probably requires many long and extra steps, such as.
- compiling Cairo and Pango to Wasm,
- either compiling a minimal TeX distribution to Wasm, or allowing to use e.g. MathJax or KaTeX as an alternative renderer for equations
- ... (I'm not a core dev, so please add other work that would have to be performed)
How can the new feature be used?
- Try out Manim directly without having to install anything on their computer.
- Real-time collaborative editing (multiple people working on the same animation at the same time).
- ...
Additional comments
Here is a basic HTML file that tries to import Manim.
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-env>
- manim
</py-env>
</head>
<body>
</body>
</html>
This throws an error:
ValueError: Couldn't find a pure Python 3 wheel for 'pycairo<2.0,>=1.19'. You can use
micropip.install(..., keep_going=True)to get a list of all packages with missing wheels.
This article explains why this happens:
To sum up, a third-party library listed in
<py-env>must be a pure-Python one and be distributed using the wheel format to be picked up, unless it’s already been built for WebAssembly and bundled with Pyodide. Getting a custom non-pure-Python library into PyScript is tricky.
I will continue to try things out and post my findings here.