python package icon
python/python

wasi

Public
wasmer run...

Python

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

$ python
Python 3.6.7 (default, Feb 14 2020, 03:17:48)
[Wasm WASI vClang 9.0.0 (https://github.com/llvm/llvm-project 0399d5a9682b3cef7 on generic
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.
Description for package python-on-the-web
Python is an interpreted, high-level, general-purpose programming language
A PHP template for WCGI applications
cpython with switchcase syntax added compiled to webassembly.
cmrfrd avatar
cmrfrd avatar
An extremely fast Python linter, written in Rust.
Python is an interpreted, high-level, general-purpose programming language
mwang1 avatar
mwang1 avatar
http server that dumps environment variables and cli args

Making software universally accessible