mo-imports
More Imports! - Delayed importing
Decision gist · record as of 2026-08-14
Yes, if you have circular dependencies in a modular codebase. The expect/export pattern is cleaner and more maintainable than inline imports or end-of-file imports, and the package is stable with low friction. The aging maintenance status (last release 425 days ago) is a minor concern for a mature utility, but check whether the pattern fits your use case—delay_import has limitations for non-callable values.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a single lightweight dependency (mo-future).
- Maintenance is aging—last release was 425 days ago, though the repository remains active and the package has been stable since its 2020 initial release.
License · maintenance · safety
MPL 2.0 (copyleft) — Licensed under MPL 2.0 (copyleft). You must disclose source code modifications and distribute under the same license if you modify and redistribute the package, but can use it in proprietary applications without disclosing your own code.
last release 2025-06-15 (425 days) · last repo commit 2025-06-15 · 2 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 335,768 downloads/mo, #7,472 on PyPI
Alternatives
Verify before relying
# Install
pip install mo-imports
# Use expect/export pattern to break cycles
# foos.py
from mo_imports import expect
bar = expect("bar")
# bars.py
from mo_imports import export
export("bars", bar)- Whether delay_import() works correctly with type checkers and IDE autocompletion
- Performance overhead of expect/export pattern at scale with many circular dependencies
- Compatibility with dynamic import systems or import hooks beyond standard Python imports
What it is and what it does
mo-imports solves the problem of circular module dependencies by providing two main patterns: expect/export for explicit cycle breaking, and delay_import for lazy loading. When modules import each other at the top level, Python can fail or produce incomplete initialization. This package lets you declare expected names upfront (expect) and fulfill them later (export), or defer imports until first use (delay_import), keeping all imports visible at the top of files rather than scattered inline or at the bottom.
The package depends only on mo-future and installs as a pure Python wheel with no compiled dependencies. It targets Python 3.9 through 3.13 and has been maintained since 2020, though releases have slowed. The expect/export pattern is the recommended approach for most cycles; delay_import is simpler but requires the imported name to be called or accessed to trigger loading, so it cannot be used for sentinel values or default arguments.
Use it for
- Break circular imports in modular libraries where two or more modules need to reference each other's functions or classes.
- Defer expensive imports (e.g., heavy data science or ML libraries) until they are actually used in a function.
- Maintain clean import organization at the top of files while resolving cycles that would otherwise require inline or end-of-file imports.
- Verify at module load time that all expected names are exported, catching configuration errors early rather than at runtime.
- Refactor monolithic code into separate modules without restructuring to avoid cycles or keeping code in a single file.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have circular dependencies in a modular codebase.
The expect/export pattern is cleaner and more maintainable than inline imports or end-of-file imports, and the package is stable with low friction. The aging maintenance status (last release 425 days ago) is a minor concern for a mature utility, but check whether the pattern fits your use case—delay_import has limitations for non-callable values.
Install
mo-imports on PyPI
Before you install
Low install friction with a single lightweight dependency (mo-future). Maintenance is aging—last release was 425 days ago, though the repository remains active and the package has been stable since its 2020 initial release.
License in practice
Licensed under MPL 2.0 (copyleft). You must disclose source code modifications and distribute under the same license if you modify and redistribute the package, but can use it in proprietary applications without disclosing your own code.
Quickstart
# Install
pip install mo-imports
# Use expect/export pattern to break cycles
# foos.py
from mo_imports import expect
bar = expect("bar")
# bars.py
from mo_imports import export
export("bars", bar)
Verify before relying
- Whether delay_import() works correctly with type checkers and IDE autocompletion
- Performance overhead of expect/export pattern at scale with many circular dependencies
- Compatibility with dynamic import systems or import hooks beyond standard Python imports
Package facts
| License | MPL 2.0 copyleft |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagemo-future |
| Maintenance | Aging 425 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 335,768 / month, #7,472 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaLicense :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: mo_imports-7.685.25166-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “circular dependency resolution”
- mo-importsProvides patterns to resolve circular module dependencies in Python…
- rodiRodi is a dependency injection container for Python that resolves and…
- cyclicDetects and reports cyclic relationships in a directed graph by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also py-import-cycles · cyclic · mo-future · import-deps · importlab · emport · pydeps · lazy-import · delayed-assert · lazy-imports