Registry / serialization / importlib

importlib

JSON →
library1.0.4pypypiunverified

This `importlib` package on PyPI is a backport of the `importlib.import_module()` function from Python 2.7. It was created to provide this functionality for Python versions prior to 2.7 and Python 3.0. This project has been archived since November 2017 and is no longer maintained, as the functionality it backported is standard in all currently supported Python versions. It is *not* the standard library `importlib` module fundamental to Python 3's import system.

pip install importlib
INSTALL
IMPORT
SIG · IMPORTLIB
I
importlib
serializationpythonv1.0.4
Install
2.8s avg
Import
Disk
12MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✕ build_error
py 3.12
✓ —
✓ 2.95s
py 3.13
✓ —
✓ 2.6s
py 3.9
✕ build_error
✕ build_error
12MB installed
● package 12MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

import_module
import importlib module = importlib.import_module('my_module')
from importlib import import_module
While `from importlib import import_module` is valid for the Python 2.7 standard library and later, the primary use case for this *PyPI backport* was to add `importlib.import_module` where it wasn't natively available, typically accessed as `importlib.import_module()`.

A basic example demonstrating the use of `importlib.import_module()` from this backport. This package is only relevant for very old Python versions. For Python 3, `importlib` is a built-in standard library module.

import importlib # This PyPI package primarily provides importlib.import_module # for older Python 2.x environments where it wasn't built-in. # For Python 3, 'importlib' is a standard library module. try: # Attempt to dynamically import a module math_module = importlib.import_module('math') print(f"Successfully imported math module. sqrt(16) = {math_module.sqrt(16)}") except ImportError as e: print(f"Could not import module: {e}") print("Note: This 'importlib' PyPI package is a Python 2.7 backport and is obsolete for modern Python 3.x.")
Debug
Known issues
breakingThis PyPI `importlib` package is a backport specifically for Python versions prior to 2.7 and for Python 3.0. It is completely obsolete and unnecessary for Python 2.7+ and Python 3.1+ where `importlib` is a standard library module. Installing it on modern Python 3 environments provides no benefit and can lead to confusion.
fix
For Python 2.7+ and Python 3.1+, `importlib` is a standard library. Do not install this PyPI package. Simply `import importlib` directly.
affects: < 2.7, 3.0
deprecatedThe `importlib` PyPI project has been explicitly archived by its maintainer since November 2017 and is no longer under maintenance. No new releases, bug fixes, or security updates will be provided.
fix
Migrate to a supported Python version (Python 3.x) where `importlib` is part of the standard library and actively maintained as part of the CPython project. The functionality provided by this backport (`importlib.import_module()`) is built-in.
affects: All versions
gotchaThere is significant confusion between the PyPI `importlib` package (this backport) and the `importlib` module in Python's standard library. The standard library `importlib` is a powerful, actively developed module in all Python 3 versions, offering extensive functionality for programmatic importing, module metadata (`importlib.metadata`), and resource access (`importlib.resources`). This PyPI package only backports a tiny fraction of that functionality.
fix
Always confirm whether you need the standard library's `importlib` (which is highly likely for modern Python) or this long-abandoned backport (which is highly unlikely). For Python 3, simply `import importlib`.
affects: All versions
gotchaWhen performing dynamic imports, be mindful of relative imports. If `importlib.import_module()` is used with a relative name (e.g., `.mymodule`), the `package` argument must be provided as the anchor package name, otherwise an `ImportError` or `ModuleNotFoundError` may occur.
fix
When performing relative imports with `importlib.import_module()`, specify the `package` argument, e.g., `importlib.import_module('.relative_module', package='my_package')`.
affects: N/A (relevant for standard library `importlib.import_module()`)
deprecatedFor complex dynamic loading scenarios in Python 3, `importlib.find_loader()` is deprecated since Python 3.4. It should be replaced with `importlib.util.find_spec()`. Similarly, `loader.load_module()` is deprecated since 3.4 and will be removed in 3.15; use `loader.exec_module()` instead.
fix
Update code to use `importlib.util.find_spec()` to obtain a `ModuleSpec`, and then `loader.exec_module()` for module execution.
affects: Standard library `importlib` in Python 3.4+
Upgrade
Version history
1.0.4latest on PyPI · released Aug 31, 2016
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources