Skip to main content

pyodide-importer

Pyodide + external file import support

Installation

Inside Pyodide:

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

Basic Usage

from pyodide_importer import register_hook
register_hook("<Base URL where python scripts are in>")
import external_module

Example

import micropip
await micropip.install("pyodide-importer")
from pyodide_importer import register_hook
register_hook("https://raw.githubusercontent.com/ryanking13/pyodide-importer/main/test_modules/")

# 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()

Advanced Usage

Whitelisting modules to import

Whitelisting modules will prevent from generating redundant HTTP requests when looking for not existing modules.

register_hook(
    "<Base URL where python scripts are in>",
    modules=["module1", "module2"]
)

Changing path where modules will be downloaded

download_path option changes the path where modules will be downloaded inside the virtual file system, default is set to the current working directory.

register_hook(
    "<Base URL where python scripts are in>",
    download_path="/path/to/be/downloaded",
)

Metadata

Release files for pyodide-importer 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyodide-importer 0.0.2
File Size Uploaded Provenance
pyodide-importer-0.0.2.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyodide-importer 0.0.2
File Interpreter ABI Platform
pyodide_importer-0.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.2 kB

Release files / pyodide-importer-0.0.2.tar.gz

Download URL pyodide-importer-0.0.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5857250a514e1261204672af8f09d2896e0e7d6311cc35b2428ef86fce0ee750
BLAKE2b-256 checksum
How to use checksums
37a0fc5ddffc05bd405c0fc12908e2037e24fb480dc92a31b96c37dd7305a114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

Release files / pyodide_importer-0.0.2-py2.py3-none-any.whl

Download URL pyodide_importer-0.0.2-py2.py3-none-any.whl
Size 6.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
46797ca55eee47ec82a3083914b6cb21725eced3f45bffbde8d507b5e4443ddf
BLAKE2b-256 checksum
How to use checksums
3b6d5ae3f6d857949a6a4515164ed1868f3a618da5d6ad22061ecc0bd3d2c0f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

Security for pyodide-importer 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page