pyodide-importer documentation

Overview

build

pyodide-importer is a plugin for the Pyodide which adds functionalities to import external Python packages through HTTP(s).

Note

pyodide-impoter is designed to be used inside Pyodide environment. If you want to “import file thorugh HTTP” in native Python environment, try httpimport instead.

Quickstart

Loading Python package through HTTP(s):

>>> import micropip
>>> await micropip.install("pyodide-importer")

>>> from pyodide_importer import register_hook
>>> url = "https://raw.githubusercontent.com/ryanking13/pyodide-importer/main/test_modules/"
>>> register_hook(url)
>>> # now you can import python packages from `url`

>>> # https://raw.githubusercontent.com/ryanking13/pyodide-importer/main/test_modules/file_module.py
>>> import file_module
>>> file_module.hello()

>>> # https://raw.githubusercontent.com/ryanking13/pyodide-importer/main/test_modules/regular_module/__init__.py
>>> import regular_module
>>> regular_module.hello()