pyodide CLI#

This page documents the Pyodide Command Line Interface (CLI) interface. In addition to the commands defined by pyodide-build, documented below, other subcommands are defined in external packages (which can be installed with pip):

  • pyodide pack, defined in pyodide-pack is a package bundler for Pyodide

pyodide#

A command line interface for Pyodide.

Other CLI subcommands are registered via the plugin system by installing Pyodide compatible packages (e.g. pyodide-build).

pyodide [OPTIONS] COMMAND [ARGS]...

Options

--version#

auditwheel#

Auditwheel-like tool for emscripten wheels and shared libraries.

Registered by: auditwheel_emscripten

pyodide auditwheel [OPTIONS] COMMAND [ARGS]...

copy#

[Deprecated] Copy shared libraries to the wheel directory. Works same as repair. Use repair instead.

pyodide auditwheel copy [OPTIONS] WHEEL_FILE

Options

--libdir <libdir>#

Path to the directory containing the shared libraries.

Default:

lib

--output-dir <output_dir>#

Directory to output repaired wheel or shared library. (default: overwrite the input file)

Arguments

WHEEL_FILE#

Required argument

exports#

Show exports of a wheel or a shared library file.

pyodide auditwheel exports [OPTIONS] WHEEL_OR_SO_FILE

Options

--show-type, --no-show-type#

Show function type.

Default:

False

Arguments

WHEEL_OR_SO_FILE#

Required argument

imports#

Show imports of a wheel or a shared library file.

pyodide auditwheel imports [OPTIONS] WHEEL_OR_SO_FILE

Options

--show-type, --no-show-type#

Show function type.

Default:

False

Arguments

WHEEL_OR_SO_FILE#

Required argument

repair#

Repair a wheel file: copy shared libraries to the wheel directory.

pyodide auditwheel repair [OPTIONS] WHEEL_FILE

Options

--libdir <libdir>#

Path to the directory containing the shared libraries.

Default:

lib

--output-dir <output_dir>#

Directory to output repaired wheel or shared library. (default: overwrite the input file)

Arguments

WHEEL_FILE#

Required argument

show#

Show shared library dependencies of a wheel or a shared library file.

pyodide auditwheel show [OPTIONS] WHEEL_OR_SO_FILE

Arguments

WHEEL_OR_SO_FILE#

Required argument

build#

Use pypa/build to build a Python package from source, pypi or url.

Registered by: pyodide-build

pyodide build [OPTIONS] [SOURCE_LOCATION]

Options

-o, --outdir <output_directory>#

which directory should the output be placed into?

Default:

-r, --requirements <requirements_txt>#

Build a list of package requirements from a requirements.txt file

Default:

--exports <exports>#

Which symbols should be exported when linking .so files?

Default:

requested

--build-dependencies, --no-build-dependencies#

Fetch dependencies from pypi and build them too.

Default:

False

--output-lockfile <output_lockfile>#

Output list of resolved dependencies to a file in requirements.txt format

Default:

--skip-dependency <skip_dependency>#

Skip building or resolving a single dependency, or a pyodide-lock.json file. Use multiple times or provide a comma separated list to skip multiple dependencies.

Default:

--skip-built-in-packages, --no-skip-built-in-packages#

Don’t build dependencies that are built into the pyodide distribution.

Default:

True

--compression-level <compression_level>#

Compression level to use for the created zip file

Default:

6

-C, --config-setting <KEY[=VALUE>#

Settings to pass to the backend. Works same as the –config-setting option of pypa/build.

Arguments

SOURCE_LOCATION#

Optional argument

Environment variables

PYODIDE_BUILD_EXPORTS

Provide a default for --exports

build-recipes#

Build packages using yaml recipes and create pyodide-lock.json

Registered by: pyodide-build

pyodide build-recipes [OPTIONS] PACKAGES...

Options

--recipe-dir <recipe_dir>#

The directory containing the recipe of packages. If not specified, the default is ./packages

--no-deps, --no-no-deps#

If true, do not build dependencies of the specified packages.

Default:

False

--install, --no-install#

If true, install the built packages into the install_dir. If false, build packages without installing.

Default:

False

--install-dir <install_dir>#

Path to install built packages and pyodide-lock.json. If not specified, the default is ./dist.

--metadata-files, --no-metadata-files#

If true, extract the METADATA file from the built wheels to a matching *.whl.metadata file. If false, no *.whl.metadata file is produced.

Default:

False

--cflags <cflags>#

Extra compiling flags. Default: SIDE_MODULE_CFLAGS

--cxxflags <cxxflags>#

Extra compiling flags. Default: SIDE_MODULE_CXXFLAGS

--ldflags <ldflags>#

Extra linking flags. Default: SIDE_MODULE_LDFLAGS

--target-install-dir <target_install_dir>#

The path to the target Python installation. Default: TARGETINSTALLDIR

--host-install-dir <host_install_dir>#

Directory for installing built host packages. Default: HOSTINSTALLDIR

--log-dir <log_dir>#

Directory to place log files

--force-rebuild, --no-force-rebuild#

Force rebuild of all packages regardless of whether they appear to have been updated

Default:

False

--continue#

Continue a build from the middle. For debugging. Implies ‘–force-rebuild’

Default:

False

--n-jobs <n_jobs>#

Number of packages to build in parallel (default: # of cores in the system)

--compression-level <compression_level>#

Level of zip compression to apply when installing. 0 means no compression.

Default:

6

Arguments

PACKAGES#

Required argument(s)

config#

Manage config variables used in pyodide

Registered by: pyodide-build

pyodide config [OPTIONS] COMMAND [ARGS]...

get#

Get a value of a single config variable used in pyodide

pyodide config get [OPTIONS] CONFIG_VAR

Arguments

CONFIG_VAR#

Required argument

list#

List config variables used in pyodide

pyodide config list [OPTIONS]

lockfile#

manipulate pyodide-lock.json lockfiles.

Registered by: pyodide-lock

pyodide lockfile [OPTIONS] COMMAND [ARGS]...

add-wheels#

Add a set of package wheels to an existing pyodide-lock.json and write it out to pyodide-lock-new.json

Each package in the wheel will be added to the output lockfile, including resolution of dependencies in the lock file. By default this will fail if a dependency isn’t available in either the existing lock file, or in the set of new wheels.

pyodide lockfile add-wheels [OPTIONS] WHEELS...

Options

--ignore-missing-dependencies, --no-ignore-missing-dependencies#

If this is true, dependencies which are not in the original lockfile or the added wheels will be added to the lockfile. Warning: This will allow a broken lockfile to be created.

Default:

False

--input <input>#

Source lockfile

Default:

pyodide-lock.json

--output <output>#

Updated lockfile

Default:

pyodide-lock-new.json

--base-path <base_path>#

Base path for wheels - wheel file names will be created relative to this path.

--wheel-url <wheel_url>#

Base url which will be appended to the wheel location.Use this if you are hosting these wheels on a different server to core pyodide packages

Default:

Arguments

WHEELS#

Required argument(s)

py-compile#

Compile .py files to .pyc in a wheel, a zip file, or a folder with wheels or zip files.

If the provided folder contains the pyodide-lock.json file, it will be rewritten with the updated wheel / zip file paths and sha256 checksums.

Registered by: pyodide-build

pyodide py-compile [OPTIONS] PATH

Options

--silent, --no-silent#

Silent mode, do not print anything.

Default:

False

--keep, --no-keep#

Keep the original wheel / zip file.

Default:

False

--compression-level <compression_level>#

Compression level to use for the created zip file

Default:

6

Arguments

PATH#

Required argument

skeleton#

Add a new package build recipe or update an existing recipe

Registered by: pyodide-build

pyodide skeleton [OPTIONS] COMMAND [ARGS]...

pypi#

Create a new package from PyPI.

pyodide skeleton pypi [OPTIONS] NAME

Options

-u, --update#

Update an existing recipe instead of creating a new one

Default:

False

--update-patched#

Force update the package even if it contains patches.

Default:

False

--version <version>#

The version of the package, if not specified, latest version will be used.

--source-format <source_format>#

Which source format is preferred. Options are wheel or sdist. If not specified, then either a wheel or an sdist will be used.

--recipe-dir <recipe_dir>#

The directory containing the recipe of packages.If not specified, the default is <cwd>/packages.

Arguments

NAME#

Required argument

venv#

Create a Pyodide virtual environment

Registered by: pyodide-build

pyodide venv [OPTIONS] DEST

Arguments

DEST#

Required argument