Standard Library
Workers written in Python are executed by Pyodide ↗.
Pyodide is a port of CPython to WebAssembly — for the most part it behaves identically to CPython ↗ (the reference implementation of Python — commonly referred to as just "Python"). The majority of the CPython test suite passes when run against Pyodide. For the most part, you shouldn't need to worry about differences in behavior.
The full Python Standard Library ↗ is available in Python Workers, with the following exceptions:
The following modules are not available in Python Workers:
- curses
- dbm
- ensurepip
- fcntl
- grp
- idlelib
- lib2to3
- msvcrt
- pwd
- resource
- syslog
- termios
- tkinter
- turtle.py
- turtledemo
- venv
- winreg
- winsound
The following modules can be imported, but are not functional due to the limitations of the WebAssembly VM.
- multiprocessing
- threading
The following are present but cannot be imported due to a dependency on the termios package which has been removed:
- pty
- tty
decimal: The decimal module has C (_decimal) and Python (_pydecimal) implementations with the same functionality. Only the C implementation is available (compiled to WebAssembly)pydoc: Help messages for Python builtins are not availablewebbrowser: The original webbrowser module is not available.
Python Workers have access to an ephemeral, in-memory filesystem. You can read and write files using standard Python file I/O (for example, open(), pathlib.Path), but all data is lost when the Worker isolate is destroyed. The filesystem is not shared between different isolate instances.
This can be useful for temporary file operations, but should not be relied upon for persistent storage. Use KV, R2, or Durable Objects for durable storage.