python package icon
python/python

wasi

Public
wasmer run python/python

Python

Python is now compiled to WebAssembly and WASI, so it can run in your server or in your browser.

$ python
Python 3.12.0 (heads/wasix-compatibility-dirty:186ebc7b8b, Oct  3 2023, 10:47:09) [Clang 15.0.6 ] on wasix
Type "help", "copyright", "credits" or "license" for more information.
>>>

Examples

Here are a few examples of Python programs that you can try:

Hello World

This is a program that reads the input and prints it:

name = input("What's your name? ")
print(f"Hello, {name}!")

Mandlebrot

A mandlebrot program:

w = 40.0
h = 25.0

def mandel():
    y = 0.0
    while y < h:
        x = 0.0
        while x < w:
            Zr, Zi, Tr, Ti = 0.0, 0.0, 0.0, 0.0
            Cr = 2 * x / w - 1.5
            Ci = 2 * y / h - 1.0

            i = 0
            while i < w and Tr + Ti <= 4:
                Zi = 2 * Zr * Zi + Ci
                Zr = Tr - Ti + Cr
                Tr = Zr * Zr
                Ti = Zi * Zi
                i += 1

            if Tr + Ti <= 4:
                print('*', end='')
            else:
                print('.', end='')

            x += 1
            yield

        print()
        y += 1
        yield

# run the mandelbrot

try: from browser import request_animation_frame
except: request_animation_frame = None

gen = mandel()
def gen_cb(_time=None):
    for _ in range(4): gen.__next__()
    request_animation_frame(gen_cb)
if request_animation_frame: gen_cb()
else: any(gen)

Python is an interpreted, high-level, general-purpose programming language


Github
More packages
Browser site for python.
Deployable
Deployable
python web shell
Deployable
Deployable
python web shell
Deployable
Deployable
python web shell
Deployable
Deployable
Description for package python-on-the-web
python web shell
Deployable
Deployable
kmpartner/python-docs py worker
Deployable
Deployable
wasmer/python-http-server py worker
wasmer/python-flask-server py worker
Deployable
Deployable

Making software universally accessible