skillfed

emport

Utility library for performing programmatic imports

emport v1.4.1 92.7K downloads/30d#13,436 on PyPI6
Permissive license BSD 3-Clause License AGING released

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 emport

uv

uv add emport

poetry

poetry add emport

Installing 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

Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

import python file by filenamedynamic module loadingprogrammatic importsload python file at runtimeimport from pathrelative import handlingimport directory as module
dynamic-importsmodule-loading

More Software Development packages