Registry / devops / emport

emport

JSON →
library1.4.1pypypi✓ verified 81d ago

Utility library for performing programmatic imports, supporting absolute and relative imports, module reloading, and import path manipulation. Version 1.4.1, requires Python >=3.8, maintained on GitHub.

pip install emport
INSTALL
IMPORT
SIG · EMPORT
E
emport
devopspythonv1.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

import_file
from emport import import_file
from emport import import_module
ModuleSpec
from emport import ModuleSpec
set_package_name
from emport import set_package_name

Demonstrates basic dynamic import with import_module.

from emport import import_module # Dynamically import a module module = import_module('os.path') print(module.join('a', 'b')) # Outputs: a/b # Import relative to a package # package = import_module('.submodule', package='mypackage')
Debug
Known issues
gotchaimport_module does not add the module to sys.modules by default; use reload_module for that.
fix
Use import_module if you only need a reference; use reload_module if you want it cached.
affects: all
gotchaRelative imports require a 'package' argument; otherwise they are interpreted as absolute.
fix
Always pass package='parent' when using dot-notation (e.g., '.submodule').
affects: >=1.0
gotchaimport_module with a dotted path does not import intermediate packages; the top-level must be importable.
fix
Ensure the parent package is importable before calling import_module on submodules.
affects: all
Upgrade
Version history
1.4.1latest on PyPI · released Oct 13, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
emport — pip install emport · libregistry