API Reference

Python API

Backward compatibility of the API is not guaranteed at this point.

pyodide.as_nested_list(obj)

Convert a nested JS array to nested Python list.

pyodide.eval_code(code, ns)

Runs a code string.

pyodide.find_imports(code)

Finds the imports in a string of code

pyodide.get_completions(code[, cursor, …])

Get code autocompletion candidates

pyodide.open_url(url)

Fetches a given URL

pyodide.JsException

A wrapper around a Javascript Error to allow the Error to be thrown in Python.

Javascript API

Backward compatibility of the API is not guaranteed at this point.

pyodide.globals

An alias to the global Python namespace

pyodide.loadPackage(names, …)

Load a package or a list of packages over the network

pyodide.loadedPackages

Object with loaded packages.

pyodide.pyimport(name)

Access a Python object in the global namespace from Javascript

pyodide.repr(obj)

Gets the Python’s string representation of an object.

pyodide.runPython(code)

Runs Python code from Javascript.

pyodide.runPythonAsync(code, …)

Runs Python code with automatic preloading of imports.

pyodide.version()

Returns the pyodide version.

Micropip API

micropip.install(requirements)

Install the given package and all of its dependencies.