NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #458 most downloaded on PyPI
Clean single-source support for Python 3 and 2
Last release 3 years ago
no release in 18 months
Release timing varies
gaps range from 9 days to 3.2 years
Some releases are documented
notes for 26 of 52 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
52 releases · first in 2013
The new version number of 1.0.0 indicates that the python-future project, like Python 2, is now done.
The new version number of 1.0.0 indicates that the python-future project, like
Python 2, is now done.
The most important change in this release is adding support for Python 3.12
(ba1cc50 and a6222d2 and bcced95).
This release also includes these fixes:
One column per quarter.
Avoid DeprecationWarning caused by invalid escape
This is a minor bug-fix release containing a number of fixes:
This is a minor bug-fix release containing a number of fixes:
This is a minor bug-fix release containing a number of fixes:
Python 3.8 is not yet officially supported.
This is a minor bug-fix release containing a fix for raise_() when passed an exception that's not an Exception (e.g. BaseException subclasses)
This is a minor bug-fix release containing a fix for raise_()
when passed an exception that's not an Exception (e.g. BaseException
subclasses)
This is a major bug-fix and feature release, including:
This is a major bug-fix and feature release, including:
As well as a number of corrections to a variety of documentation, and updates to
test infrastructure.
This release address a packaging error because of an erroneous declaration that any built wheels are universal.
This release address a packaging error because of an erroneous declaration that
any built wheels are universal.
This is a major bug-fix release, including:
This is a major bug-fix release, including:
__future__ bug in futurize (issue #113)__get__ in newsuperAs well as a number of corrections to a variety of documentation, and updates to test infrastructure.
Update What's New doc to mention that issue #141 is fixed in v0.16.0
Update What's New doc to mention that issue #141 is fixed in v0.16.0
This release removes the configparser package as an alias for ConfigParser on Py2 to improve compatibility with the backported configparser package <https://pypi.org/project/configparser/>. Previously python-future and the PyPI configparser backport clashed, causing various compatibility issues. (Issues #118, #181)
If your code previously relied on configparser being supplied by python-future, the recommended upgrade path is to run pip install configparser or add configparser to your requirements.txt file.
Note that, if you are upgrading future with pip, you may need to uninstall the old version of future or manually remove the site-packages/future-0.15.2-py2.7.egg folder for this change to take effect on your system.
This releases also fixes these bugs:
Fix newbytes constructor bug. (Issue #171)
Fix semantics of bool() with newobject. (Issue #211)
Fix standard_library.install_aliases() on PyPy. (Issue #205)
Fix assertRaises for pow and compile` on Python 3.5. (Issue #183)
Fix return argument of future.utils.ensure_new_type if conversion to new type does not exist. (Issue #185)
Add missing cmp_to_key for Py2.6. (Issue #189)
Allow the old_div fixer to be disabled. (Issue #190)
Improve compatibility with Google App Engine. (Issue #231)
Add some missing imports to the tkinter and tkinter.filedialog package namespaces. (Issues #212 and #233)
More complete implementation of raise_from on PY3. (Issues #141, #213 and #235, fix provided by Varriount)
This is a minor bug-fix release:
This is a minor bug-fix release:
Fix socket.create_connection() backport on Py2.6 (issue #162)
Add more tests of urllib.request etc.
Fix newsuper() calls from the __init__ method of PyQt subclassses (issue #160, thanks to Christopher Arndt)
Merge branch 'v0.15.x' and tag 'v0.15.1'
Merge branch 'v0.15.x' and tag 'v0.15.1'
This is a minor bug-fix release:
Use 3-argument socket.create_connection() backport to restore Py2.6 compatibility in urllib.request.urlopen() (issue #162)
Remove breakpoint in future.backports.http.client triggered on certain data (issue #164)
Move exec fixer to stage 1 of futurize because the forward-compatible exec(a, b) idiom is supported in Python 2.6 and 2.7. See https://docs.python.org/2/reference/simple_stmts.html#exec.
This release fixes compatibility bugs with CherryPy's Py2/3 compat layer and the latest version of the urllib3 package. It also adds some additional b
This release fixes compatibility bugs with CherryPy's Py2/3 compat layer and the latest version of the urllib3 package. It also adds some additional backports for Py2.6 and Py2.7 from Py3.4's standard library.
New features:
install_aliases() now exposes full backports of the Py3 urllib submodules (parse, request etc.) from future.backports.urllib as submodules of urllib on Py2. This implies, for example, that urllib.parse.unquote now takes an optional encoding argument as it does on Py3. This improves compatibility with CherryPy's Py2/3 compat layer (issue #158).
tkinter.ttk support (issue #151)
Backport of collections.ChainMap (issue #150)
Backport of itertools.count for Py2.6 (issue #152)
Enable and document support for the surrogateescape error handler for newstr and newbytes objects on Py2.x (issue #116). This feature is currently in alpha.
Add constants to http.client such as HTTP_PORT and BAD_REQUEST (issue #137)
Backport of reprlib.recursive_repr to Py2
Bug fixes:
Add HTTPMessage to http.client, which is missing from httplib.__all__ on Python <= 2.7.10. This restores compatibility with the latest urllib3 package (issue #159, thanks to Waldemar Kornewald)
Expand newint.__divmod__ and newint.__rdivmod__ to fall back to <type 'long'> implementations where appropriate (issue #146 - thanks to Matt Bogosian)
Fix newrange slicing for some slice/range combos (issue #132, thanks to Brad Walker)
Small doc fixes (thanks to Michael Joseph and Tim Tröndle)
Improve robustness of test suite against opening .pyc files as text on Py2
Update backports of Counter and OrderedDict to use the newer implementations from Py3.4. This fixes .copy() preserving subclasses etc.
futurize no longer breaks working Py2 code by changing basestring to str. Instead it imports the basestring forward-port from past.builtins (issues #127 and #156)
future.utils: add string_types etc. and update docs (issue #126)
Expose contents of thread (not dummy_thread) as _thread on Py2 (Issue #124)
This is a bug-fix release:
Expose contents of thread (not dummy_thread) as _thread on Py2 (Issue #124)
Add signed support for newint.to_bytes() (Issue #128)
Fix OrderedDict.clear() on Py2.6 (Issue #125)
Improve newrange: equality and slicing, start/stop/step properties, refactoring (Issues #129, #130)
Minor doc updates
Speed up importing of past.translation (Issue #117)
This is a bug-fix release:
Speed up importing of past.translation (Issue #117)
html.escape(): replace function with the more robust one from Py3.4
futurize: avoid displacing encoding comments by __future__ imports (Issues #97, #10, #121)
futurize: don't swallow exit code (Issue #119)
Packaging: don't forcibly remove the old build dir in setup.py (Issue #108)
Docs: update further docs and tests to refer to install_aliases() instead of install_hooks()
Docs: fix iteritems import error in cheat sheet (Issue #120)
Tests: don't rely on presence of test.test_support on Py2 or test.support on Py3 (Issue #109)
Tests: don't override existing PYTHONPATH for tests (PR #111)
This is a minor bug-fix release:
This is a minor bug-fix release:
Docs: add a missing template file for building docs (Issue #108)
Tests: fix a bug in error handling while reporting failed script runs (Issue #109)
install_aliases(): don't assume that the test.test_support module always exists on Py2 (Issue #109)
The following deprecated internal modules have been removed (Issue #80):
This is a major new release that offers a cleaner interface for most imports in Python 2/3 compatible code.
Instead of this interface:
>>> from future.builtins import str, open, range, dict >>> from future.standard_library import hooks >>> with hooks(): ... import queue ... import configparser ... import tkinter.dialog ... # etc.
You can now use the following interface for much Python 2/3 compatible code:
>>> # Alias for future.builtins on Py2: >>> from builtins import str, open, range, dict >>> # Alias for future.moves.* on Py2: >>> import queue >>> import configparser >>> import tkinter.dialog >>> etc.
Notice that the above code will run on Python 3 even without the presence of the future package. Of the 44 standard library modules that were refactored with PEP 3108, 30 are supported with direct imports in this manner. (These are listed here: direct-imports.)
The other 14 standard library modules that kept the same top-level names in Py3.x are not supported with this direct import interface on Py2. These include the 5 modules in the Py3 urllib package. These modules are accessible through the following interface (as well as the interfaces offered in previous versions of python-future):
from future.standard_library import install_aliases install_aliases() from collections import UserDict, UserList, UserString import dbm.gnu from itertools import filterfalse, zip_longest from subprocess import getoutput, getstatusoutput from sys import intern import test.support from urllib.request import urlopen from urllib.parse import urlparse # etc. from collections import Counter, OrderedDict # backported to Py2.6
The complete list of packages supported with this interface is here: list-standard-library-refactored.
For more information on these and other interfaces to the standard library, see standard-library-imports.
This release expands the future.moves package to include most of the remaining modules that were moved in the standard library reorganization (PEP 3108). (Issue #104)
This release also removes the broken --doctests_only option from the futurize and pasteurize scripts for now. (Issue #103)
The project folder structure has changed. Top-level packages are now in a src folder and the tests have been moved into a project-level tests folder.
The following deprecated internal modules have been removed (Issue #80):
future.utils.encoding and future.utils.six.
The following internal functions have been deprecated and will be removed in a future release:
future.standard_library.scrub_py2_sys_modules
future.standard_library.scrub_future_sys_modules
Fix (multiple) inheritance of future.builtins.object with metaclasses (Issues #91, #96)
This is a bug-fix release:
Fix (multiple) inheritance of future.builtins.object with metaclasses (Issues #91, #96)
Fix futurize's refactoring of urllib imports (Issue #94)
Fix futurize --all-imports (Issue #101)
Fix futurize --output-dir logging (Issue #102)
Doc formatting fix (Issues #98, #100)
The following unused internal modules are now deprecated. They will be removed in a future release:
This is mostly a clean-up release. It adds some small new compatibility features and fixes several bugs.
The following unused internal modules are now deprecated. They will be removed in a future release:
future.utils.encoding and future.utils.six.
(Issue #80). See here for the rationale for unbundling them.
Docs: Add compatible-idioms from Ed Schofield's PyConAU 2014 talk.
Add newint.to_bytes() and newint.from_bytes(). (Issue #85)
Add future.utils.raise_from as an equivalent to Py3's raise ... from ... syntax. (Issue #86)
Add past.builtins.oct() function.
Add backports for Python 2.6 of subprocess.check_output(), itertools.combinations_with_replacement(), and functools.cmp_to_key().
Use a private logger instead of the global logger in future.standard_library (Issue #82). This restores compatibility of the standard library hooks with flask. (Issue #79)
Stage 1 of futurize no longer renames next methods to __next__ (Issue #81). It still converts obj.next() method calls to next(obj) correctly.
Prevent introduction of a second set of parentheses in print() calls in some further cases.
Fix isinstance checks for subclasses of future types. (Issue #89)
Be explicit about encoding file contents as UTF-8 in unit tests. (Issue #63) Useful for building RPMs and in other environments where LANG=C.
Fix for 3-argument pow(x, y, z) with newint arguments. (Thanks to @str4d.) (Issue #87)
Fix upcasting behaviour of newint. (Issue #76)
Fix upcasting behaviour of newint. (Issue #76)
Fix deprecated unittest usage in Py3. (Issue #62)
Add "official Python 3.4 support": Py3.4 is now listed among the PyPI Trove classifiers and the tests now run successfully on Py3.4. (Issue #67)
Add backports of collections.OrderedDict and collections.Counter for Python 2.6. (Issue #52)
Add --version option for futurize and pasteurize scripts. (Issue #57)
Fix future.utils.ensure_new_type with long input. (Issue #65)
Remove some false alarms on checks for ambiguous fixer names with futurize -f ....
Don't hard-code Python interpreter command in tests. (Issue #62)
Fix deprecated unittest usage in Py3. (Issue #62)
Be explicit about encoding temporary file contents as UTF-8 for when LANG=C (e.g., when building an RPM). (Issue #63)
All undecorated tests are now passing again on Python 2.6, 2.7, 3.3, and 3.4 (thanks to Elliott Sales de Andrade).
Add list of fixers used by futurize. (Issue #58)
Add list of contributors to the Credits page.
Add bytes.maketrans() method. (Issue #51)
Add bytes.maketrans() method. (Issue #51)
Add support for Python versions between 2.7.0 and 2.7.3 (inclusive). (Issue #53)
Bug fix for newlist(newlist([1, 2, 3])). (Issue #50)
Python 2.6 support: future.standard_library now isolates the importlib dependency to one function (import_) so the importlib backport may not be neede
Python 2.6 support: future.standard_library now isolates the importlib dependency to one function (import_) so the importlib backport may not be needed.
Doc updates
Note: backwards-incompatible change: As previously announced (see deprecated-auto-import-hooks), the import hooks must now be enabled explicitly, as f…
The major new feature in this version is improvements in the support for the reorganized standard library (PEP 3108) and compatibility of the import mechanism with 3rd-party modules.
Note: backwards-incompatible change: As previously announced (see deprecated-auto-import-hooks), the import hooks must now be enabled explicitly, as follows:
from future import standard_library
with standard_library.hooks():
import html.parser
import http.client
...
This now causes these modules to be imported from future.moves, a new package that provides wrappers over the native Python 2 standard library with the new Python 3 organization. As a consequence, the import hooks provided in future.standard_library are now fully compatible with the Requests library.
The functional interface with install_hooks() is still supported for backwards compatibility:
from future import standard_library standard_library.install_hooks(): import html.parser import http.client ... standard_library.remove_hooks()
Explicit installation of import hooks allows finer-grained control over whether they are enabled for other imported modules that provide their own Python 2/3 compatibility layer. This also improves compatibility of future with tools like py2exe.
There is a new future.types.newobject base class (available as future.builtins.object) that can streamline Py2/3 compatible code by providing fallback Py2-compatible special methods for its subclasses. It currently provides next() and __nonzero__() as fallback methods on Py2 when its subclasses define the corresponding Py3-style __next__() and __bool__() methods.
This obviates the need to add certain compatibility hacks or decorators to the code such as the @implements_iterator decorator for classes that define a Py3-style __next__ method.
In this example, the code defines a Py3-style iterator with a __next__ method. The object class defines a next method for Python 2 that maps to __next__:
from future.builtins import object
class Upper(object):
def __init__(self, iterable):
self._iter = iter(iterable)
def __next__(self): # note the Py3 interface
return next(self._iter).upper()
def __iter__(self):
return self
assert list(Upper('hello')) == list('HELLO')
newobject defines other Py2-compatible special methods similarly: currently these include __nonzero__ (mapped to __bool__) and __long__ (mapped to __int__).
Inheriting from newobject on Python 2 is safe even if your class defines its own Python 2-style __nonzero__ and next and __long__ methods. Your custom methods will simply override those on the base class.
On Python 3, as usual, future.builtins.object simply refers to builtins.object.
The past.builtins module is much more compatible with the corresponding builtins on Python 2; many more of the Py2 unit tests pass on Py3. For example, functions like map() and filter() now behave as they do on Py2 with with None as the first argument.
The past.builtins module has also been extended to add Py3 support for additional Py2 constructs that are not adequately handled by lib2to3 (see Issue #37). This includes new execfile() and cmp() functions. futurize now invokes imports of these functions from past.builtins.
The newstr type (future.builtins.str) now supports a backport of the Py3.x 'surrogateescape' error handler for preserving high-bit characters when encoding and decoding strings with unknown encodings.
There is a new list type in future.builtins that offers .copy() and .clear() methods like the list type in Python 3.
future.utils now contains helper functions listvalues and listitems, which provide Python 2-style list snapshotting semantics for dictionaries in both Python 2 and Python 3.
These came out of the discussion around Nick Coghlan's now-withdrawn PEP 469.
There is no corresponding listkeys(d) function; use list(d) instead.
The number of unit tests has increased from 600 to over 800. Most of the new tests come from Python 3.3's test suite.
The backported standard library modules have been moved to future.backports to make the distinction clearer between these and the new future.moves package.
Alpha versions of backports of the http.server and urllib module from Python 3.3's standard library are now provided in future.backports.
Use them like this:
from future.backports.urllib.request import Request # etc. from future.backports.http import server as http_server
Or with this new interface:
from future.standard_library import import_, from_import
Request = from_import('urllib.request', 'Request', backport=True)
http = import_('http.server', backport=True)
The future.builtins.types module has been moved to future.types. Likewise, past.builtins.types has been moved to past.types. The only user-visible effect of this is to change repr(type(obj)) for instances of these types. For example:
>>> from future.builtins import bytes >>> bytes(b'abc') >>> type(b) future.types.newbytes.newbytes
Instead of:
>>> type(b) # prior to v0.12 future.builtins.types.newbytes.newbytes
Many small improvements and fixes have been made across the project. Some highlights are:
Fixes and updates from Python 3.3.5 have been included in the backported standard library modules.
Scrubbing of the sys.modules cache performed by remove_hooks() (also called by the suspend_hooks and hooks context managers) is now more conservative.
The fix_next and fix_reduce fixers have been moved to stage 1 of futurize.
futurize: Shebang lines such as #!/usr/bin/env python and source code file encoding declarations like # -*- coding=utf-8 -*- are no longer occasionally displaced by from __future__ import ... statements. (Issue #10)
Improved compatibility with py2exe (Issue #31).
The future.utils.bytes_to_native_str function now returns a platform-native string object and future.utils.native_str_to_bytes returns a newbytes object on Py2. (Issue #47).
The backported http.client module and related modules use other new backported modules such as email. As a result they are more compliant with the Python 3.3 equivalents.
This release contains various small improvements and fixes:
This release contains various small improvements and fixes:
This release restores Python 2.6 compatibility. (Issue #42)
The fix_absolute_import fixer now supports Cython .pyx modules. (Issue #35)
Right-division with newint objects is fixed. (Issue #38)
The fix_dict fixer has been moved to stage2 of futurize.
Calls to bytes(string, encoding[, errors]) now work with encoding and errors passed as positional arguments. Previously this only worked if encoding and errors were passed as keyword arguments.
The 0-argument super() function now works from inside static methods such as __new__. (Issue #36)
future.utils.native(d) calls now work for future.builtins.dict objects.
This release has improvements in the standard library import hooks mechanism and its compatibility with 3rd-party modules:
This release has improvements in the standard library import hooks mechanism and its compatibility with 3rd-party modules:
The __exit__ function of the hooks context manager and the remove_hooks function both now remove submodules of future.standard_library from the sys.modules cache. Therefore this code is now possible on Python 2 and 3:
from future import standard_library
standard_library.install_hooks()
import http.client
standard_library.remove_hooks()
import requests
data = requests.get('http://www.google.com')
Previously, this required manually removing http and http.client from sys.modules before importing requests on Python 2.x. (Issue #19)
This change should also improve the compatibility of the standard library hooks with any other module that provides its own Python 2/3 compatibility code.
Note that the situation will improve further in version 0.12; import hooks will require an explicit function call or the hooks context manager.
The futurize and pasteurize scripts now add an explicit call to install_hooks() to install the standard library import hooks. These scripts now add these two lines:
from future import standard_library standard_library.install_hooks()
instead of just the first one. The next major version of future (0.12) will require the explicit call or use of the hooks context manager. This will allow finer-grained control over whether import hooks are enabled for other imported modules, such as requests, which provide their own Python 2/3 compatibility code.
There is a new --unicode-literals flag to futurize that adds the import:
from __future__ import unicode_literals
to the top of each converted module. Without this flag, futurize now no longer adds this import. (Issue #22)
The pasteurize script for converting from Py3 to Py2/3 still adds unicode_literals. (See the comments in Issue #22 for an explanation.)
Nothing published for this version
Nothing published for this version
Nothing published for this version
The functions install_hooks() and remove_hooks() were previously called enable_hooks() and disable_hooks(). The old names are deprecated (but are stil…
There is a new context manager future.standard_library.hooks. Use it like this:
from future import standard_library
with standard_library.hooks():
import queue
import configserver
from http.client import HTTPConnection
# etc.
If not using this context manager, it is now encouraged to add an explicit call to standard_library.install_hooks() as follows:
from future import standard_library standard_library.install_hooks() import queue import html import http.client # etc.
And to remove the hooks afterwards with:
standard_library.remove_hooks()
The functions install_hooks() and remove_hooks() were previously called enable_hooks() and disable_hooks(). The old names are deprecated (but are still available as aliases).
As usual, this feature has no effect on Python 3.
Nothing published for this version
Thanks to Joel Tratner for the contribution of these. future.utils.reraise() is now deprecated.
future.builtins now provides a Python 2 dict subclass whose keys, values, and items methods produce memory-efficient iterators. On Python 2.7, these also have the same set-like view behaviour as on Python 3. This can streamline code needing to iterate over large dictionaries. For example:
from __future__ import print_function
from future.builtins import dict, range
squares = dict({i: i**2 for i in range(10**7)})
assert not isinstance(d.items(), list)
# Because items() is memory-efficient, so is this:
square_roots = dict((i_squared, i) for (i, i_squared) in squares.items())
For more information, see dict-object.
The functions raise_with_traceback() and raise_() were added to future.utils to offer either the Python 3.x or Python 2.x behaviour for raising exceptions. Thanks to Joel Tratner for the contribution of these. future.utils.reraise() is now deprecated.
A portable exec_() function has been added to future.utils from six.
Fixed newint.__divmod__
Improved robustness of installing and removing import hooks in future.standard_library
v0.10.1: Fixed broken pip install future on Py3
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →