Questions about skulpt underlying Anvil

What I’m trying to do:

Estimate the reliability of skulpt as the basis for Anvil

What I’ve tried and what’s not working:

Hello, I maintain the pure python web application survey guide and currently have Anvil rated as a Class A framework, meaning that it is industrial strength, well-maintained, well-documented with good support channels.

My concern with Anvil is more with the fact that Skulpt is what it is built on, yet skulpt is showing some serious concerns. I originally articulated my concerns here, but was told that new users could only have 2 links in their post, so I enumerate by concerns here - Concerns about Skulpt underlying Anvil | thee brane ov….

1 Like

I can’t answer the points about the issues or other metric in the repository, but, as an happy industrial user of Anvil, I can tell you that the Anvil team is active maintainer of Skulpt, that there are features of python 3.6 like f-strings, and that more features are added as they are requested in this forum.

I don’t know how active is the Skulpt repository, but I know that I have seen many requests about Skulpt improvements, both language features and standard library modules, here in this forum that have been addressed as if this were the Skulpt repository.

I don’t know if I would use Skulpt alone (just because i don’t know it well enough alone), but I feel comfortable with using it inside Anvil.

1 Like

A more updated version of the manual page you linked to is available here: skulpt/ at master · skulpt/skulpt · GitHub

Admittedly, though, the out-of-date Skulpt docs is a problem in itself.

But while there are many open issues and pull requests, the recent commit history shows that maintainers remain active. (The fact that the original author is no longer the most active maintainer seems unimportant.) And I trust that maintainers are reviewing pull requests and issues and triaging things to address any critical issues.

Hi @thequietcenter and welcome to the forum,

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.

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).

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]

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

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:

anvil - or console in the IDE
pyodide -
brython - Brython interactive mode
rust python - RustPython Demo
cpython/pypy - locally using ipython on m1 mac