Hi @thequietcenter and welcome to the forum,
Documentation:
Skulpt documentation is not good. It’s not up to date and if you were a first time user/contributor of Skulpt you’d probably get quite frustrated. The best way to understand Skulpt is to read the source code. This isn’t really a problem for an Anvil users since Anvil users should never have to interact with Skulpt directly.
Maintainers:
Skulpt’s original author no longer contributes to the project. Instead there are a handful of active maintainers who oversee the project (myself and @meredydd included). Most of those maintainers use Skulpt in their own projects, so have a vested interest in keeping it relevant. This is also one of the reasons why the documentation is poor - the maintainers have other priorities and are familiar with the inner workings of Skulpt for their use case. Having other priorities also means pull requests (especially larger ones) take time; github issues are not always resolved; the link discussion group isn’t active. (Welcome to open source).
Versions:
Skulpt compiles to Python 3.7ish or 2.7ish. This ish means that Skulpt may differ from the Python standard because some features are not implemented. Skulpt aims to move towards the standard over time. It does this mostly through improving test coverage, implementing stdlib modules and other python standards. e.g. the Calendar module was recently added and metaclasses were recently implemented. At some point Skulpt will inevitable move to 3.9/3.10 or some other later version.
Other considerations:
- It’s worth looking at the contributions to Skulpt, which are regular.
- Anvil runs a fork of Skulpt, which is closely aligned to the main repo but may be ahead or behind.
- Skulpt is actually (one of, if not) the fastest browser based implementation of Python out there (See end notes to test this for yourself).
Performance Comparison Notes
I found the following code snippet runs faster in Skulpt than any other Python implementation:
from time import time
def fib(num):
t = time()
a, b = 1, 0
i = 0
while i < num:
a, b = a + b, a
i += 1
print(f"fib({num:,}) took: {time() - t:.2f} seconds")
return str(b)[:20]
fib(2**19)
fib(2**20)
2**19
-------
cpython - fib(524,288) took: 3.27 seconds
pypy - fib(524,288) took: 2.02 seconds
skulpt - fib(524,288) took: 1.94 seconds
rust python in browser - fib(524,288) took: 8.96 seconds
pyodide - fib(524,288) took: 3.17 seconds
brython - waited a few minutes without a result
2**20
-----
cpython - fib(1,048,576) took: 12.96 seconds
pypy - fib(1,048,576) took: 8.71 seconds
skulpt - fib(1,048,576) took: 7.09 seconds
rust python in browser - fib(1,048,576) took: 35.01 seconds (browser became unresponsive)
pyodide - fib(1,048,576) took: 12.45 seconds
brython - waited a few minutes without a result
I ran these tests a few months ago on an M1 mac using Chrome (or ipython), numbers will differ on a different OS/browser/day:
Sources:
anvil - https://anvil-repl.anvil.app/ or console in the IDE
pyodide - https://pyodide.org/en/stable/console.html
brython - Brython interactive mode
rust python - RustPython Demo
cpython/pypy - locally using ipython on m1 mac