emport
Utility library for performing programmatic imports
What it is and what it does
Emport is a small utility library that wraps Python's import machinery to load modules from arbitrary file paths. It exposes a single function, `import_file(filename)`, that handles the plumbing of converting a file path into an importable module object. The main value is that it abstracts away the complexity of edge cases: importing files that live inside packages (where relative imports matter), importing directories as packages by loading their `__init__.py`, and other scenarios where the standard `__import__`, `execfile`, or `imp.load_source` approaches either fail or require boilerplate.
The package depends only on logbook for logging. It supports Python 3.8 through 3.13 and is distributed as a pure Python wheel, so installation is straightforward. The codebase is stable and aging—last updated in October 2025 with minimal recent activity—but carries no known security vulnerabilities and remains functional for its narrow, well-defined purpose.
Use it for:
- Load plugin or configuration modules from user-specified file paths without requiring them to be on sys.path.
- Dynamically import test fixtures or helper modules stored outside the standard package structure.
- Build tools or scripts that need to import Python files from arbitrary locations on disk.
- Import modules that use relative imports from within packages, where standard import mechanisms would fail.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Emport provides a single function to import Python files by filename, handling edge cases like relative imports within packages and directory/`__init__.py` imports that standard import mechanisms don't easily support.
Yes, if you need to import Python files by path and want to avoid the boilerplate of managing import hooks or manipulating sys.path. The low install friction, permissive license, and lack of vulnerabilities make it a safe choice. However, the aging maintenance status and minimal activity suggest it is not actively developed; if you encounter edge cases or need new features, expect to maintain a fork or use an alternative.
Install
emport on PyPI
pip
pip install emportuv
uv add emportpoetry
poetry add emportInstalling emport
Before you install
Low friction: pure Python wheel, single lightweight dependency (logbook), and supports current Python versions (3.8–3.13). Last commit was recent (2025-10-07), though the package is aging overall with no active development signal.
License in practice
BSD 3-Clause License is permissive; you may use, modify, and distribute this package freely in commercial and private projects, provided you retain the license notice.
Quickstart
pip install emport
from emport import import_file
my_module = import_file('/path/to/file.py')
Verify before relying
- Whether relative imports within imported files work correctly in all contexts (e.g., when the imported file references sibling modules).
- Performance characteristics when importing large files or many files in sequence.
- Compatibility with frozen/packaged applications (PyInstaller, etc.).
Package facts
| License | BSD 3-Clause License (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — logbook |
| Maintenance | aging — 670 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 92,662/month — #13,436 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: emport-1.4.1-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
locateProvides utilities to locate the current Python…
unclear · top 5,000 on PyPI
pyinvokeInvokes Python functions by full module path…
permissive · top 15,000 on PyPI
absolufy-importsAutomatically converts relative imports to…
permissive · top 15,000 on PyPI
ipynbImports Jupyter Notebook (.ipynb) files as…
permissive · top 15,000 on PyPI
rootpathDetects a Python project or package root…
permissive · top 15,000 on PyPI
mo-importsProvides patterns to resolve circular module…
copyleft · top 15,000 on PyPI
import-depsAnalyzes Python module imports statically using…
permissive · top 5,000 on PyPI
tendoTendo provides utility functions for Python…
permissive · top 15,000 on PyPI
lazy-importDefers module loading and ImportErrors until a…
copyleft · top 15,000 on PyPI
bazel-runfilesProvides a Python API to locate and access…
permissive · top 5,000 on PyPI