Easy, clean, reliable Python 2/3 compatibility¶
python-future
is the missing compatibility layer between Python 2 and
Python 3. It allows you to use a single, clean Python 3.x-compatible
codebase to support both Python 2 and Python 3 with minimal overhead.
Contents¶
- What’s New
- Overview: Easy, clean, reliable Python 2/3 compatibility
- Quick-start guide
- Cheat Sheet: Writing Python 2-3 compatible code
- Imports
- What else you need to know
- Automatic conversion to Py2/3
- Frequently Asked Questions (FAQ)
- Standard library incompatibilities
- Older interfaces
- Changes in previous versions
- Changes in version 0.18.3 (2023-01-13)
- Changes in version 0.18.2 (2019-10-30)
- Changes in version 0.18.1 (2019-10-09)
- Changes in version 0.18.0 (2019-10-09)
- Changes in version 0.17.1 (2018-10-30)
- Changes in version 0.17.0 (2018-10-19)
- Changes in version 0.16.0 (2016-10-27)
- Changes in version 0.15.2 (2015-09-11)
- Changes in version 0.15.1 (2015-09-09)
- Changes in version 0.15.0 (2015-07-25)
- Changes in version 0.14.3 (2014-12-15)
- Changes in version 0.14.2 (2014-11-21)
- Changes in version 0.14.1 (2014-10-02)
- Changes in version 0.14.0 (2014-10-02)
- Changes in version 0.13.1 (2014-09-23)
- Changes in version 0.13.0 (2014-08-13)
- Changes in version 0.12.4 (2014-07-18)
- Changes in version 0.12.3 (2014-06-19)
- Changes in version 0.12.2 (2014-05-25)
- Changes in version 0.12.1 (2014-05-14)
- Changes in version 0.12.0 (2014-05-06)
- More robust standard-library import hooks
newobject
base object defines fallback Py2-compatible special methodspast.builtins
module improvedsurrogateescape
error handlernewlist
typelistvalues
andlistitems
- Tests
- Refactoring of
future.standard_library.*
->future.backports
- Backported
http.server
andurllib
modules - Internal refactoring
- Bug fixes
- Changes in version 0.11.4 (2014-05-25)
- Changes in version 0.11.3 (2014-02-27)
- Changes in version 0.11 (2014-01-28)
- Changes in version 0.10.2 (2014-01-11)
- Changes in version 0.10.0 (2013-12-02)
- Changes in version 0.9 (2013-11-06)
- Changes in version 0.8 (2013-10-28)
- Summary of all changes
- Licensing and credits
- API Reference (in progress)
- future.builtins Interface
- Backported types from Python 3
- future.standard_library Interface
- Limitations
RenameImport
cache_py2_modules()
detect_hooks()
disable_hooks()
enable_hooks()
exclude_local_folder_imports
from_import()
hooks
import_()
install_aliases()
install_hooks()
is_py2_stdlib_module()
remove_hooks()
restore_sys_modules()
scrub_future_sys_modules()
scrub_py2_sys_modules()
suspend_hooks
- future.utils Interface
as_native_str()
binary_type
bind_method()
exec_()
implements_iterator()
is_new_style()
isbytes()
isidentifier()
isint()
isnewbytes()
istext()
iteritems()
iterkeys()
itervalues()
native()
native_bytes
native_str
native_str_to_bytes()
old_div()
python_2_unicode_compatible()
raise_()
raise_with_traceback()
reraise()
text_type
tobytes()
viewitems()
viewkeys()
viewvalues()
with_metaclass()
- past.builtins Interface
- Forward-ported types from Python 2