├── meetings ├── 2023 │ ├── wasm_europython2023.jpeg │ ├── webassembly-summit-europython.md │ └── webassembly-summit-pycon-us.md └── 2024 │ ├── webassembly-summit-pycon-us.md │ └── webassembly-summit-europython.md ├── README.md └── .gitignore /meetings/2023/wasm_europython2023.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psf/webassembly/HEAD/meetings/2023/wasm_europython2023.jpeg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python on WebAssembly 2 | 3 | This repo exists to track the progress of Python on WebAssembly (WASM), 4 | as a central location to pull in meeting notes, reference links, project 5 | updates and some light project management. 6 | 7 | We're tracking meetings in the `meetings` subdirectory and order them by year 8 | given that this will likely be a multi-year effort. 9 | 10 | ## Links 11 | 12 | ### Communication 13 | 14 | - [WebAssembly Category on the Python Discourse](https://discuss.python.org/c/webassembly/28) 15 | - [#Python channel on the WebAssembly Discord server](https://discord.com/channels/453584038356058112/915046161126137856) 16 | 17 | ### Information 18 | 19 | - [Blog post on WebAssembly platform triples](https://snarky.ca/webassembly-and-its-platform-targets/) 20 | - [Blog post on State of WASI support for CPython: June 2023](https://snarky.ca/wasi-support-for-cpython-june-2023/) 21 | 22 | ### Running/Using 23 | 24 | - [Instructions for building CPython for WebAssembly](https://github.com/python/cpython/blob/main/Tools/wasm/README.md) 25 | 26 | #### WASI 27 | 28 | - [Blog post on running pytest with WASI](https://snarky.ca/testing-a-project-using-the-wasi-build-of-cpython-with-pytest/) 29 | 30 | ##### Builds 31 | 32 | - [CPython from Brett Cannon](https://github.com/brettcannon/cpython-wasi-build) (to experiment with what might eventually come from python.org) 33 | - [CPython from VMWare](https://github.com/vmware-labs/webassembly-language-runtimes) 34 | 35 | #### Browser 36 | 37 | ##### Builds 38 | 39 | - [CPython from Pyodide](https://pyodide.org/) 40 | -------------------------------------------------------------------------------- /meetings/2024/webassembly-summit-pycon-us.md: -------------------------------------------------------------------------------- 1 | # WebAssembly Summit at PyCon US 2024 - Pittsburgh 2 | 3 | [Website](https://us.pycon.org/2024/events/webassembly-summit/) 4 | 5 | Organisers: 6 | 7 | * Dr. Brett Cannon - Microsoft 8 | * Fabio Pliger - Anaconda 9 | * Nicholas Tollervey - Anaconda 10 | 11 | ## Agenda 12 | 13 | ### Morning - talks MC'd by Nicholas 14 | 15 | * Pyodide (Dr. Hood Chatham) - An update on the current state of Pyodide (CPython compiled to WASM) by Hood, a core maintainer of the project. 16 | * [Blog post with updates](https://blog.pyodide.org/posts/0.26-release/) 17 | * MicroPython (Dr. Damien George) - A pre-recorded video updating us on the current state of MicroPython compiled to web assembly. 18 | * [Unlisted YouTube version](https://youtu.be/6icY5Pq3NOM) 19 | * WASI and Python (Eric Snow/Dawn Wages/Mike Droettboom) - An outline of the current state of WASI (WebAssembly System Interface) support in CPython. 20 | * [Tier 2 support is here](https://discuss.python.org/t/wasi-has-been-promoted-to-a-tier-2-platform/45525) 21 | * PyScript (Fabio Pliger) - Updates, developments, future plans in the world of PyScript (a platform for Python in the browser). 22 | * [PyScript homepage](https://pyscript.net) 23 | * PySheets / LTK (Dr. Chris Laffra) - a demonstration and description of PySheets - a spreadsheet UI for notebook like coding, written with PyScript. 24 | * [LTK](https://github.com/pyscript/ltk) 25 | * [PySheets](https://pysheets.app/) 26 | * Using Web Assembly to Teach Code Generation in an Undergraduate Compiler Design Course (Ariel Ortiz) - With the Arpeggio and wasmtime Python packages it is possible to use a vertical slice approach in order to teach how to build incrementally a fully working compiler in just under 16 hrs. The language being compiled supports only one data type (32 bit integer), arithmetic, relational, and logic operators, variables, and also conditional and loop statements. The target language is the WebAssembly text format. 27 | 28 | ### Afternoon - unconference discussion MC'd by Fabio 29 | 30 | * ??? 31 | 32 | ## Other PyCon WASM Activity 33 | 34 | * [Making Your Documentation Interactive with PyScript](https://us.pycon.org/2024/schedule/presentation/92/) - Jeff Glass 35 | * [Interactive Software Documentation, with PyScript](https://us.pycon.org/2024/schedule/presentation/115/) - Valerio Maggio 36 | * [Build in-browser 3D experiences with WebGL and PyScript](https://us.pycon.org/2024/schedule/presentation/139/) - Łukasz Langa 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /meetings/2024/webassembly-summit-europython.md: -------------------------------------------------------------------------------- 1 | # EuroPython 2024 Web Assembly Summit 2 | 3 | Held in Prague. Event website here: https://ep2024.europython.eu/session/webassembly-summit 4 | 5 | We had around 15 sign up, and several more turn up on the day. 6 | 7 | As with last year, the morning consisted of presentations, with a discussion 8 | scheduled for the afternoon. 9 | 10 | ## Presentations 11 | 12 | The talks presented in the morning were: 13 | 14 | * Patrick Armino: presenting Strawberry rocks (cancelled). 15 | * Chris Laffra: PySheets and/or profiling with PyScript. 16 | * Hood Chatham: State of the Pyodide Union. 17 | * Josh Lowe: Migrating Edublocks to PyScript. 18 | * Antonio Cuni: SPy summary. 19 | * Nicholas Tollervey: State of PyScript Union. 20 | 21 | 22 | These were presented in a "seminar fashion" where people were encouraged to 23 | respectfully interrupt, question, debate and otherwise constructively engage 24 | during the presentation of the subject matter. 25 | 26 | ## Afternoon discussion 27 | 28 | The following topics were discussed (taken from notes provided by Chris Laffra): 29 | 30 | * WASM specific: 31 | * WASI -> Arjun Ramesh and Ben Titzer's WALI (Web Assembly Linux Interface): niche, light-weight and secure "docker" for WASM. [Proposal paper](https://www.semanticscholar.org/paper/Stop-Hiding-The-Sharp-Knives%3A-The-WebAssembly-Linux-Ramesh-Huang/2544ea6d1cb37723b3988b7874981048357a614d) 32 | * PyScript related: 33 | * UI toolkits: 34 | * [Invent](https://inventframework.org/), `pyscript.web` API ([docs](https://docs.pyscript.net/2024.8.2/user-guide/dom/#pyscriptweb)), [puepi](https://puepy.dev/)) 35 | * [Pygame Zero](https://pygame-zero.readthedocs.io/en/stable/index.html) - can we run it in PyScript? Performance is the challenge. 36 | * **TODO**: we should create an FFI-aware kernel to run games (like PGZero). 37 | * Check out [Streamlit](https://streamlit.io/). 38 | * PyScript [LTK](https://github.com/pyscript/ltk) - client side rendering of UIs on top of jQuery and PyScript. 39 | * Integration with JS frameworks: 40 | * [HTMXXX](https://htmxxx.fly.dev/) 41 | * Jinja templates to JS? 42 | * Pyodide focused: 43 | * Reducing the footprint, compression - do like Pyrun (remove stuff, compress). 44 | * Reducing startup time: 45 | * We need to improve packages to download all dependencies at once, rather than one wheel at a time. [Previous online context/discussion](https://github.com/pyodide/pyodide/issues/2045#issuecomment-1423248534). 46 | * We should parallelize startup and package downloads. 47 | * Cache entire file-system as a snapshot with all packages pre-installed (an idea from Nicholas). 48 | * Related: memory snapshots. 49 | * WASM-fs will improve things, rather than the current JS version. 50 | * Nightly packages are now a thing. 51 | -------------------------------------------------------------------------------- /meetings/2023/webassembly-summit-europython.md: -------------------------------------------------------------------------------- 1 | # EuroPython 2023 Web Assembly Summit 2 | 3 | Held in Prague. Event website here: https://ep2023.europython.eu/wasm 4 | 5 | We had around 30 folks register, with the vast majority turning up, along with 6 | "on the day" hangers on. 7 | 8 | The day was organised as an un-conference by Nicholas and Roman and split in 9 | two parts: ad hoc presentations in the morning, with discussions, hacking etc 10 | in the afternoon. 11 | 12 | ## Presentations 13 | 14 | The talks presented in the morning were: 15 | 16 | * PyScript - a quick overview (Nicholas Tollervey - Anaconda) 17 | * Load time and download size for Python in the browser (Roman Yurchak - 18 | Pyodide) 19 | * Emscripten Forge (Thorsten Beier - Quantstack) 20 | * The state of packaging in Pyodide (Hood Chatham - Anaconda / Pyodide) 21 | * A history of Python in the Browser (Pascal Chambon) 22 | * Python is the browser - Grail! (Russell Keith-Magee - Anaconda) 23 | * Introducing SPy: Python-ish compiled directly to WASM (Antonio Cuni - 24 | Anaconda) 25 | 26 | These were presented in a "seminar fashion" where people were encouraged to 27 | respectfully interrupt, question, debate and otherwise constructively engage 28 | during the presentation of the subject matter. 29 | 30 | ## Packaging debate 31 | 32 | The main focus for discussion in the afternoon was packaging in the context of 33 | WebAssembly. The TL;DR is something we've named the Lemburg Paradox (named 34 | after Marc-Andre Lemburg who coined the concept): 35 | 36 | > "The only conclusion we can reach when it comes to Python packaging, is that 37 | > there is no conclusion." 38 | 39 | These words of wisdom were uttered after an extensive, deep and broad debate 40 | containing many attendant experts in the field (Jannis Leidel [conda/PSF], 41 | Thorsten Beier [EmscriptenForge], Hood/Roman [Pyodide], RKM [BeeWare] etc...). 42 | It was suggested at the start of the conversation that we should aim to 43 | conclude with a to-do list of next steps / collaborations / tasks we all agreed 44 | ought to be done in the packaging space. In the end, so broad, diverse and 45 | different are the various contexts in which people are working on packaging, 46 | that the only rational conclusion is the Lemburg Paradox. 47 | 48 | However, perhaps the most important side-effect of these presentations and 49 | discussions was the friendliness of the debate and the resulting community 50 | strengthening as all the different people working in this space were able to 51 | meet, share ideas and learn something of the emergent geography of the 52 | WASM/packaging community. 53 | 54 | It was agreed we should do this again, and soon, in a similar format. 55 | 56 | ## Photos 57 | 58 | The WASM EuroPython class of '23. 59 | 60 | ![The WASM EuroPython class of '23](wasm_europython2023.jpeg "The WASM EuroPython class of '23") 61 | 62 | ## Post Event Buzz 63 | 64 | The summit was discussed at some length in the following episode of PyScriptTV: 65 | 66 | 67 | -------------------------------------------------------------------------------- /meetings/2023/webassembly-summit-pycon-us.md: -------------------------------------------------------------------------------- 1 | # WebAssembly Summit at PyCon US 2023 - Salt Lake City 2 | 3 | Attendees and organization: https://discuss.python.org/t/creating-an-attendee-list-for-the-webassembly-summit-at-pycon-us-2023-on-thursday-april-20th/23509 4 | 5 | ## Brett: Update on Emscripten 6 | 7 | [snarky.ca blog post](https://snarky.ca/webassembly-and-its-platform-targets/) 8 | 9 | ### Emscripten 10 | - History: predated WASM 11 | - Browser 12 | - compile -> WebAssembly 13 | - JS 14 | - CPython 15 | - Multiple backends 16 | - Trying to move toward WASI or POSIX API 17 | 18 | ### WASI 19 | - server stuff (edge compute) 20 | - embedded 21 | - "POSIX" for WebAssembly 22 | - Get security 23 | - Runtime provides a sandbox 24 | 25 | ### Bytecode Alliance 26 | - industry consortium 27 | - WASI main focus 28 | 29 | *Note: some discussions will apply only WASI or Emscripten* 30 | 31 | Implications on packages 32 | 33 | Most attendees interested in Frontend side. A few for WASI server stuff. A handful for both. 34 | 35 | ### Q: How do we talk about WebAssembly to the rest of the community? 36 | - Glossary of things 37 | - Verbs and Nouns (Trey were confusing) 38 | - Leverage the web communities (Jannis) 39 | - Which platform to choose? If you are interested in ... 40 | 41 | ## WebAssembly - CPython (Brett) 42 | 43 | Tier 3 now: no SLA; core devs can't rip out 44 | Steering Council approval; working buildbot; coredev support 45 | - 2 platforms 46 | - Microsoft donated buildbot 47 | [PEP 11](https://peps.python.org/pep-0011/) explains tier support 48 | Tier 2: SLA guarantee about things keeping working 49 | - Main branch within 24 hours must fix broken 50 | - Steering Council approval 51 | - Buildbot stable; runs every commit or trigger by core dev 52 | - 2 Core Devs 53 | Tier 1: Main will never be broken 54 | 55 | Currently at Tier 3. 56 | 57 | ### WASI CPython (Brett) 58 | - Trying to get to Tier 2: Goal end of year 59 | - Written dev container for WASI (talk to Brett at sprint) 60 | - Buildbot 61 | - Kushal / Eric core dev support 62 | - Toolchain: ensure the core dev can easily do a build 63 | - Documentation ([CPython/tools/wasm/README.md](https://github.com/python/cpython/tree/main/Tools/wasm)) 64 | - 65 | #### WASI Standard 66 | - Preview 1 standard 67 | - Preview 2 standard under review 68 | - Working toward to 1.0 69 | - [go WASI support](https://github.com/golang/go/issues/58141) explicit on `preview1`/`preview2` support, not a concern for Python (up to the wasm runtime, not Python to support) 70 | - Next to add async 71 | - WASI SDK always ship with stable clang 72 | 73 | ### Emscripten 74 | - Currently Tier 3 75 | - Brett not expert here. 76 | - Need someone to own a buildbot 77 | - Toolchain is more complex 78 | - Hood contact for Emscripten builds 79 | - PyScript team/Anaconda can run the buildbot 80 | - [Buildbot Documentation Links](https://www.python.org/dev/buildbot/) 81 | - Later then there can be a PEP to determine how to do packaging 82 | - Discussion with QuantStack about Emscripten unfinished (PyScript maybe to reach out at Europython) 83 | 84 | ## After lunch session 85 | 86 | - Question: Can/should the binding between Python and Javascript (in pyodide) be maintained outside Pyodide? Moved into Python itself? 87 | - Hood: We've wanted to extract it into its own module. It is pretty stable and mostly feature complete. It could go in the standard library if there is interest. 88 | - Dynamic loading and WASI 89 | - Bytecode Alliance: Historically focused on C/C++/Rust. Last few months they have started paying more attention to dynamic languages. 90 | - Open question is how to deal with extension modules in a way that works for all languages (not just Python) 91 | - Can we have WASI support for dlopen() and dlsym()? 92 | - Discussion is very new, so no conclusions yet 93 | - What is the ABI situation for WASI? 94 | - Is there risk that Python interpreter built one way won't work with extension modules built a different way 95 | - WASI will specify features using "worlds", and we will specify the worlds that Python needs (and extensions will need that minimum level of build) 96 | - WASI does not yet specify an exact signature for a C call, which is needed for ABI 97 | - PyPI now has a topic for marking compatibility with WebAssembly (all), or specifically WASI or Emscripten 98 | - Question: What is VSCode WASI support for things like NumPy 99 | - Modules have to all be statically linked into the python module 100 | - NumPy has been done, Pandas is partially done 101 | 102 | ### State of Emscripten Packaging 103 | - Wheels are built using a separate tool (similar to crossenv, but different) 104 | - Need to trick packages to believe they are building for the target platform 105 | - Tagging wheel with emscripten-wasm32 106 | - Where should the wheels go? 107 | - Can't put them on PyPI now 108 | - Currently serving them from jsdelivr 109 | - Need to decide what the ABI is for "standard" wheels. Need a manylinux-like spec for this. 110 | - Working on getting cibuildwheel to build emscripten wheels 111 | - Currently wheels are tagged with the emscripten version 112 | - Emscripten will break ABI from time to time (switching time counter to 64-bit example) 113 | - ABI breaks also happen when Emscripten unwinds hacks as new WASM features are enabled 114 | - (discussion of how dynamic loading works in emscripten. could not transcribe all of this) 115 | - challenge to define "emscripten wheels" without making them "pyodide wheels" because there are various flag options that are really pyodide specific and not generic to emscripten 116 | - Option: if we say that Python 3.X will require Emscripten Y, then do we have a problem if we need to update Emscripten? 117 | - Plan to standardize wheels after a large upcoming patch to Emscripten, after which point we should be able to link the Emscripten version to the Python minor version 118 | - We know how to write auditwheel for emscripten wheels 119 | - Concern that "emscripten" is not a platform like "macos". There is example in the room of of two different emscripten builds that technically would not be compatible. 120 | - Antonio: Most important thing is to make it possible for people to have webassembly builds in their CI. We can update the specs later once that story settles. 121 | - cibuildwheel should have emscripten support merged in a few weeks [PR](https://github.com/pypa/cibuildwheel/pull/1456) 122 | - Proposal: 123 | - Treat pyodide version as the platform tag, rather than emscripten (emscripten version is implied by pyodide version) 124 | - Will require writing a PEP to define this 125 | - Question: How does pip determine what are compatible tags? 126 | - No need for platform specific logic. Only want exact match of tag 127 | - Pyodide is too many things? 128 | - Foreign function interface - getting stable, could be decoupled. Tied to python version, not emscripten version. 129 | - Distribution (set of prebuilt packages): Could be separated out to work more like conda-forge 130 | - ACTION: Hood will write the PEP once some moving parts settle down (in a few months) 131 | - Going to get some buy in from other core packages using cibuildwheel 132 | 133 | - Question: What's going on with emscripten-forge? 134 | - Big focus on JupyterLite use cases right now 135 | - Some conda-forge maintainers concerned about the load on the volunteers to bring all the Emscripten stuff into conda-forge project 136 | - Continuing for now async from conda-forge 137 | - no interest in WASI (also, WASI can't handle dynamic loading right now anyway, so moot for now) 138 | - Topic for later: Packaging in the browser is fundamentally different. Should we think about this differently? 139 | - Could we standardize a static build (app packaging) step 140 | - Who is going to host these artifacts (no one wants to sign up to run a CDN) 141 | - Brett: Don't need to rush all these solutions. We can take time to get this right. 142 | 143 | ### Pyodide demo 144 | 145 | (Hood demoed pyodide and cibuildwheel support) 146 | 147 | ### Future discussions/communication 148 | 149 | https://discuss.python.org/c/webassembly/28 150 | 151 | 152 | ## Links 153 | 154 | Example GH actions for building pyodide wheels 155 | - https://github.com/sourmash-bio/sourmash/blob/c952507f151a09cc1ed701f3a509bc50f7184c8b/.github/workflows/build_wheel.yml#L58-L84 156 | - https://github.com/sourmash-bio/sourmash/blob/555563dd6abe1bd52a4cdd17c596fe79f4675d72/.github/workflows/build_wheel.yml#L91 157 | --------------------------------------------------------------------------------