Pyodide CLI

raw JSON →
0.5.0 verified Fri May 01 auth: no python

Command-line interface for building and managing Pyodide packages and distributions. Current version 0.5.0, requires Python >=3.12. Part of the Pyodide project (WebAssembly Python runtime). Release cadence is sporadic, tied to Pyodide releases.

pip install pyodide-cli
error ModuleNotFoundError: No module named 'pyodide_cli'
cause Package not installed or installed in a different Python environment.
fix
Run 'pip install pyodide-cli' in the correct Python environment.
error pyodide: command not found
cause The CLI script is not on PATH. On some installations, the console script may not be registered.
fix
Install with 'pip install pyodide-cli' and ensure Python's bin directory is on PATH. Alternatively, run via 'python -m pyodide_cli'.
error ConfigError: No pyodide configuration found. Please run 'pyodide init' or set PWDIR environment variable.
cause The CLI needs a configuration or Pyodide source directory to operate.
fix
Run 'pyodide init' in your project directory or set the PWDIR environment variable to point to a Pyodide checkout.
breaking Pyodide CLI 0.5.0 requires Python 3.12 or higher. Attempting to install on older versions will fail.
fix Upgrade Python to >=3.12, or use an older version of pyodide-cli if available (e.g., 0.4.x for Python 3.11).
deprecated The CLI command 'pyodide dir' has been deprecated in favor of 'pyodide config' as of pyodide-cli 0.5.0.
fix Replace 'pyodide dir' with 'pyodide config show' or 'pyodide config set'.
gotcha Running 'pyodide build' without a valid Pyodide repository or environment configuration will fail with 'ConfigError'. Ensure you have a working Pyodide setup.
fix Run 'pyodide init' to create a default configuration, or set PWDIR environment variable to a valid Pyodide checkout.

Example of programmatically invoking the CLI. Direct usage is via 'pyodide' command in terminal.

import os
import sys
from pyodide_cli import main

# Build a minimal Pyodide environment
# Example: build a virtual env with pyodide packages
# This requires additional dependencies (pyodide-build, etc.)
# Typically invoked via CLI command 'pyodide build'

if __name__ == '__main__':
    # Simulate CLI args: build a package
    sys.argv = ['pyodide', 'build', '--help']
    main()