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 ecosystem packages (e.g. pyodide-build, pyodide-pack, auditwheel-emscripten, etc.)
pyodide [OPTIONS] COMMAND [ARGS]...
Options
- --version#
Show the version of the Pyodide CLI
#
Clean build artifacts.
pyodide [OPTIONS] COMMAND [ARGS]...
Options
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
recipes#
Remove build artifacts for recipe packages.
pyodide recipes [OPTIONS] [TARGETS]...
Options
- --recipe-dir <recipe_dir>#
Directory containing package recipes. Defaults to <pyodide root>/packages.
- --build-dir <build_dir>#
Directory where package build artifacts are stored. Defaults to recipe directory.
Arguments
- TARGETS#
Optional argument(s)
Packages or tags (tag:<name>) to clean. Defaults to all packages.
Environment variables
- PYODIDE_RECIPE_BUILD_DIR
Provide a default for
--build-dir
#
Manage config variables used in pyodide
pyodide [OPTIONS] COMMAND [ARGS]...
Options
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
get#
Get a value of a single config variable used in pyodide
pyodide get [OPTIONS] CONFIG_VAR
Arguments
- CONFIG_VAR#
Required argument
A config variable to get. Use list to see all possible values.
list#
List config variables used in pyodide
pyodide list [OPTIONS]
#
Add a new package build recipe or update an existing recipe
pyodide [OPTIONS] COMMAND [ARGS]...
Options
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
disable#
pyodide disable [OPTIONS] NAMES...
Options
- -m, --message <message>#
Comment to explain why it was disabled
- Default:
''
- --recipe-dir <recipe_dir>#
The directory containing the recipe of packages. If not specified, the default is
<cwd>/packages.
Arguments
- NAMES#
Required argument(s)
enable#
pyodide enable [OPTIONS] NAMES...
Options
- --recipe-dir <recipe_dir>#
The directory containing the recipe of packages. If not specified, the default is
<cwd>/packages.
Arguments
- NAMES#
Required argument(s)
pin#
pyodide pin [OPTIONS] NAMES...
Options
- -m, --message <message>#
Comment to explain why it was pinned
- Default:
''
- --recipe-dir <recipe_dir>#
The directory containing the recipe of packages. If not specified, the default is
<cwd>/packages.
Arguments
- NAMES#
Required argument(s)
pypi#
Create a new package recipe from PyPI or update an existing recipe.
pyodide 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
- --update-pinned#
Force update the package even if is pinned.
- 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.
- -m, --maintainer <maintainer>#
The github username to use as the maintainer
- --gh-maintainer, --ghm#
Set the maintainer from ‘gh auth status’. Requires gh cli.
- Default:
False
Arguments
- NAME#
Required argument
#
Manage cross-build environment for building packages for Pyodide.
pyodide [OPTIONS] COMMAND [ARGS]...
Options
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
install#
Install cross-build environment.
The installed environment is the same as the one that would result from PYODIDE_PACKAGES=’scipy’ make except that it is much faster. The goal is to enable out-of-tree builds for binary packages that depend on numpy or scipy.
pyodide install [OPTIONS] [VERSION]
Options
- --path <path>#
destination to download cross-build environment directory to.
- Default:
PosixPath('/home/docs/.cache/.pyodide-xbuildenv-0.31.1')
- --url <url>#
URL to download cross-build environment from
- -f, --force#
force installation even if the version is not compatible
- Default:
False
Arguments
- VERSION#
Optional argument
version of cross-build environment to install
Environment variables
- PYODIDE_XBUILDENV_PATH
Provide a default for
--path
install-emscripten#
Install Emscripten SDK into the cross-build environment.
This command clones the emsdk repository, installs and activates the specified Emscripten version, and applies Pyodide-specific patches.
pyodide install-emscripten [OPTIONS]
Options
- --version <version>#
Emscripten version corresponding to the target Pyodide version
- --path <path>#
Pyodide cross-env path
- Default:
PosixPath('/home/docs/.cache/.pyodide-xbuildenv-0.31.1')
search#
Search for available versions of cross-build environment.
pyodide search [OPTIONS]
Options
- --metadata <metadata_path>#
path to cross-build environment metadata file. It can be a URL or a local file. If not given, the default metadata file is used.
- -a, --all#
search all versions, without filtering out incompatible ones
- Default:
False
- --json#
output results in JSON format
- Default:
False
uninstall#
Uninstall cross-build environment.
pyodide uninstall [OPTIONS] [VERSION]
Options
- --path <path>#
path to cross-build environment directory
- Default:
PosixPath('/home/docs/.cache/.pyodide-xbuildenv-0.31.1')
Arguments
- VERSION#
Optional argument
version of cross-build environment to uninstall
use#
Select a version of cross-build environment to use.
pyodide use [OPTIONS] VERSION
Options
- --path <path>#
path to cross-build environment directory
- Default:
PosixPath('/home/docs/.cache/.pyodide-xbuildenv-0.31.1')
Arguments
- VERSION#
Required argument
version of cross-build environment to use
version#
Print current version of cross-build environment.
pyodide version [OPTIONS]
Options
- --path <path>#
path to cross-build environment directory
- Default:
PosixPath('/home/docs/.cache/.pyodide-xbuildenv-0.31.1')
versions#
Print all installed versions of cross-build environment.
pyodide versions [OPTIONS]
Options
- --path <path>#
path to cross-build environment directory
- Default:
PosixPath('/home/docs/.cache/.pyodide-xbuildenv-0.31.1')
app#
Auditwheel-like tool for emscripten wheels and shared libraries.
pyodide app [OPTIONS] COMMAND [ARGS]...
copy#
[Deprecated] Copy shared libraries to the wheel directory. Works same as repair. Use repair instead.
pyodide app 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 app exports [OPTIONS] WHEEL_OR_SO_FILE
Options
- --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 app imports [OPTIONS] WHEEL_OR_SO_FILE
Options
- --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 app 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)
- -r, --with-runtime-paths#
Show runtime paths.
Arguments
- WHEEL_FILE#
Required argument
show#
Show shared library dependencies of a wheel or a shared library file.
pyodide app show [OPTIONS] WHEEL_OR_SO_FILE
Options
- -r, --with-runtime-paths#
Show runtime paths.
Arguments
- WHEEL_OR_SO_FILE#
Required argument
build#
Use pypa/build to build a Python package from source, pypi or url.
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.
- --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
- -n, --no-isolation#
Disable building the project in an isolated virtual environment. Build dependencies must be installed separately when this option is used
- Default:
False
- -x, --skip-dependency-check#
Do not check that the build dependencies are installed. This option is only useful when used with –no-isolation.
- Default:
False
- -C, --config-setting <KEY[=VALUE>#
Settings to pass to the backend. Works same as the –config-setting option of pypa/build.
- --xbuildenv-path <xbuildenv_path>#
Path to the cross-build environment directory.
- Default:
PosixPath('/home/docs/.cache/.pyodide-xbuildenv-0.31.1')
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
Arguments
- SOURCE_LOCATION#
Optional argument
Build source, can be source folder, pypi version specification, or url to a source dist archive or wheel file. If this is blank, it will build the current directory.
Environment variables
- PYODIDE_BUILD_EXPORTS
Provide a default for
--exports
- PYODIDE_XBUILDENV_PATH
Provide a default for
--xbuildenv-path
build-recipes#
pyodide build-recipes [OPTIONS] PACKAGES...
Options
- --recipe-dir <recipe_dir>#
The directory containing the recipe of packages. If not specified, the default is
./packages
- --build-dir <build_dir>#
The directory where build directories for packages are created. Default: recipe_dir.
- --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.metadatafile. If false, no*.whl.metadatafile is produced.- Default:
False
- --no-deps, --no-no-deps#
Removed, use pyodide build-recipes-no-deps instead.
- Default:
False
- --cflags <cflags>#
Extra compiling flags.
- --cxxflags <cxxflags>#
Extra compiling flags.
- --ldflags <ldflags>#
Extra linking flags.
- --target-install-dir <target_install_dir>#
The path to the target Python installation.
- Default:
''
- --host-install-dir <host_install_dir>#
Directory for installing built host packages.
- Default:
''
- --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
- --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
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
Arguments
- PACKAGES#
Required argument(s)
Packages to build, or
*for all packages in recipe directory
Environment variables
- PYODIDE_RECIPE_BUILD_DIR
Provide a default for
--build-dir
- PYODIDE_ZIP_COMPRESSION_LEVEL
Provide a default for
--compression-level
build-recipes-no-deps#
Build packages using yaml recipes but don’t try to resolve dependencies
pyodide build-recipes-no-deps [OPTIONS] PACKAGES...
Options
- --recipe-dir <recipe_dir>#
The directory containing the recipe of packages. If not specified, the default is
./packages
- --build-dir <build_dir>#
The directory where build directories for packages are created. Default: recipe_dir.
- --cflags <cflags>#
Extra compiling flags.
- Default:
''
- --cxxflags <cxxflags>#
Extra compiling flags.
- Default:
''
- --ldflags <ldflags>#
Extra linking flags.
- Default:
''
- --target-install-dir <target_install_dir>#
The path to the target Python installation.
- Default:
''
- --host-install-dir <host_install_dir>#
Directory for installing built host packages.
- Default:
''
- --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
- --skip-rust-setup#
Don’t setup rust environment when building a rust package
- Default:
False
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
Arguments
- PACKAGES#
Required argument(s)
Packages to build, or
*for all packages in recipe directory
Environment variables
- PYODIDE_RECIPE_BUILD_DIR
Provide a default for
--build-dir
main#
Manipulate pyodide-lock.json lockfiles.
pyodide main [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 main add-wheels [OPTIONS] WHEELS...
Options
- --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.
- --input <input>#
Source lockfile
- --output <output>#
Updated lockfile
- --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
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.
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
- --exclude <exclude>#
List of files to exclude from compilation, works only for directories. Defaults to no files.
- Default:
''
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
Arguments
- PATH#
Required argument
Path to the input wheel or a folder with wheels or zip files.
venv#
Create a Pyodide virtual environment. Additionally, this interface supports a subset of the arguments that virtualenv supports, with some minor differences for Pyodide compatibility. Please note that passing extra options is experimental and may be subject to change.
pyodide venv [OPTIONS] DEST
Options
- --clear, --no-clear#
Remove the destination directory if it exists
- Default:
False
- --no-vcs-ignore#
Don’t create VCS ignore directive in the destination directory
- Default:
False
- --no-download, --never-download#
Disable download of the latest pip/setuptools from PyPI
- Default:
False
- --download, --no-download#
Enable download of the latest pip/setuptools from PyPI
- Default:
False
- --extra-search-dir <extra_search_dir>#
A path containing wheels to extend the internal wheel list
- --pip <pip>#
Version of pip to install as seed: embed, bundle, or exact version.
- Default:
'bundle'
- --setuptools <setuptools>#
Version of setuptools to install as seed: embed, bundle, none or exact version
- --no-setuptools#
Do not install setuptools
- Default:
False
- --no-periodic-update#
Disable the periodic update of the embedded wheels
- Default:
False
- --install-completion#
Install completion for the current shell.
- --show-completion#
Show completion for the current shell, to copy it or customize the installation.
Arguments
- DEST#
Required argument
directory to create virtualenv at