Install & Compatibility
Where this runs
tested against v7.685.25166 · 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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.066s · 17.8MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.5s · import 0.062s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
text
✓ from mo_future import text
✗ from future.utils import text
mo-future provides a flat namespace, eliminating the need to search for symbols in submodules of compatibility libraries like `future` or `six`.
bytes
✓ from mo_future import bytes
✗ from six import binary_type
For Python 2/3 compatible byte string types, mo-future exposes `bytes` directly.
This quickstart demonstrates how to import and use some common compatibility shims provided by mo-future. It aims to offer Python 3-like behavior for types and functions, abstracting away Python 2/3 differences with simpler top-level imports.
from mo_future import text, bytes, range, map
# Example of using Python 3-like builtins compatible with Python 2 (if applicable)
print(type(text('hello')))
print(type(bytes(b'world')))
# range and map behave like their Python 3 counterparts (returning iterators)
my_range = range(5)
print(list(my_range))
my_map = map(lambda x: x * 2, [1, 2, 3])
print(list(my_map))
# A simple compatibility check (example, not actual mo_future feature)
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
print('Using urllib2 (Python 2 pattern)')
else:
print('Using urllib.request (Python 3 pattern)')
Debug
Known issues
breakingAs of December 2022, mo-future no longer points to Python 2-specific modules. This means code relying on `mo-future` for direct Python 2 compatibility features might break.fixReview your codebase for any Python 2-specific logic using `mo-future` shims. For truly Python 2-only compatibility, consider pinning to an older version or migrating away from Python 2 entirely.
affects: >= 7.x (since December 2022)
gotchaUsers migrating from `python-future` or `six` might incorrectly assume `mo-future` maintains the same submodule structure (e.g., `future.utils`). `mo-future` promotes a flat namespace.fixAlways import directly from the top-level `mo_future` module. For example, use `from mo_future import text` instead of `from future.utils import text` or `from six import text_type`.
affects: All versions
gotchaThe versioning scheme (e.g., 7.685.25166) appears highly granular or potentially generated. While this indicates active development, it might make tracking specific feature introductions or deprecations difficult without detailed release notes.fixRefer to the project's GitHub repository for detailed change logs and release notes to understand specific version differences.
affects: All versions
Errors
Common errors & fixes
ImportError: cannot import name 'text' from 'future.utils'
Attempting to import compatibility symbols from `future.utils` when `mo-future` expects a direct import from its top-level module.
fixChange the import statement to `from mo_future import text`. mo-future provides a flat namespace.
AttributeError: module 'mo_future' has no attribute 'foo_py2_only'
Attempting to access a Python 2-specific compatibility shim that was removed from `mo-future` after December 2022.
fixIf your project targets only Python 3, this attribute is no longer needed. If you require Python 2 compatibility, you may need to either use an older version of `mo-future` or implement Python 2-specific logic outside of `mo-future`.
TypeError: 'map' object is not subscriptable
Treating the `map` function imported from `mo_future` as if it returns a list (Python 2 behavior) instead of an iterator (Python 3 behavior).
fixExplicitly convert the `map` object to a list if you need to access elements by index or iterate over it multiple times: `list(my_map)`. The `map` from `mo_future` behaves like Python 3's `map` which returns an iterator.
Upgrade
Version history
7.685.25166latest on PyPI · released Jun 15, 2025
Audit
Dependencies
No dependency data recorded yet.