This is to work around some bugs / sloppiness in the Python 2 standard library.
The isinstance function is no longer redefined in future.builtins
to operate with the backported int, bytes and str.
isinstance checks with the backported types now work correctly by
default; we achieve this through overriding the __instancecheck__
method of metaclasses of the backported types.
By default, the futurize script now only adds the minimal set of
imports deemed necessary.
There is now an --all-imports option to the futurize script which
gives the previous behaviour, which is to add all __future__ imports
and from future.builtins import * imports to every module. (This even
applies to an empty __init__.py file.
Pychecker (as of v0.6.1)'s checker.py attempts to import the builtins
module as a way of determining whether Python 3 is running. Since this
succeeds when from future import standard_library is in effect, this
check does not work and the wrong value for pychecker's internal PY2
flag is set.
To work around this, future now provides the following context manager:
from future import standard_library
...
with standard_library.suspend_hooks():
from pychecker.checker import Checker
future now includes support for Python 2.6.
To run the future test suite on Python 2.6, this additional package is needed:
pip install unittest2
http.server also requires the argparse package:
pip install argparse
The future.six module has been removed. future doesn't require six
(and hasn't since version 0.3). If you need support for Python versions before
2.6, six is the best option. future and six can be installed
alongside each other easily if needed.
The unused hacks module has also been removed from the source tree.
isinstance() added to :mod:`future.builtins` (v0.8.2)
It is now possible to use isinstance() calls normally after importing isinstance from
future.builtins. On Python 2, this is specially defined to be compatible with
future's backported int, str, and bytes types, as well as
handling Python 2's int/long distinction.
The result is that code that uses isinstance to perform type-checking of
ints, strings, and bytes should now work identically on Python 2 as on Python 3.
The utility functions isint, istext, and isbytes provided before for
compatible type-checking across Python 2 and 3 in :mod:`future.utils` are now
deprecated.
- v0.8.3:
- New
--all-importsoption tofuturize - Fix bug with
str.encode()with encoding as a non-keyword arg
- New
- v0.8.2:
- New
isinstancefunction in :mod:`future.builtins`. This obviates and deprecates the utility functions for type-checking in :mod:`future.utils`.
- New
- v0.8.1:
- Backported
socketserver.py. Fixes sporadic test failures withhttp.server(related to threading and old-style classes used in Py2.7'sSocketServer.py). - Move a few more safe
futurizefixes from stage2 to stage1 - Bug fixes to :mod:`future.utils`
- Backported
- v0.8:
- Added Python 2.6 support
- Removed unused modules: :mod:`future.six` and :mod:`future.hacks`
- Removed undocumented functions from :mod:`future.utils`
- v0.7:
- Added a backported Py3-like
intobject (inherits from long). - Added utility functions for type-checking and docs about
isinstanceuses/alternatives. - Fixes and stricter type-checking for bytes and str objects
- Added many more tests for the
futurizescript - We no longer disable obsolete Py2 builtins by default with
from future.builtins import *. Usefrom future.builtins.disabled import *instead.
- Added a backported Py3-like
- v0.6:
- Added a backported Py3-like
strobject (inherits from Py2'sunicode) - Removed support for the form
from future import *: usefrom future.builtins import *instead
- Added a backported Py3-like
- v0.5.3:
- Doc improvements
- v0.5.2:
- Add lots of docs and a Sphinx project
- v0.5.1:
- Upgraded included
sixmodule (included asfuture.utils.six) to v1.4.1 - :mod:`http.server` module backported
- bytes.split() and .rsplit() bugfixes
- Upgraded included
- v0.5.0:
- Added backported Py3-like
bytesobject
- Added backported Py3-like
- v0.4.2:
- Various fixes
- v0.4.1:
- Added :func:`open` (from :mod:`io` module on Py2)
- Improved docs
- v0.4.0:
- Added various useful compatibility functions to :mod:`future.utils`
- Reorganized package: moved all builtins to :mod:`future.builtins`; moved
all stdlib things to
future.standard_library - Renamed
python-futurizeconsole script tofuturize - Moved
future.sixtofuture.utils.sixand pulled the most relevant definitions to :mod:`future.utils`. - More improvements to "Py3 to both" conversion (
futurize.py --from3)
- v0.3.5:
- Fixed broken package setup ("package directory 'libfuturize/tests' does not exist")
- v0.3.4:
- Added
itertools.zip_longest - Updated 2to3_backcompat tests to use futurize.py
- Improved libfuturize fixers: correct order of imports; add imports only when necessary (except absolute_import currently)
- Added
- v0.3.3:
- Added
python-futurizeconsole script - Added
itertools.filterfalse - Removed docs about unfinished backports (urllib etc.)
- Removed old Py2 syntax in some files that breaks py3 setup.py install
- Added
- v0.3.2:
- Added test.support module
- Added UserList, UserString, UserDict classes to collections module
- Removed
int->longmapping - Added backported
_markupbase.pyetc. with new-style classes to fix travis-ci build problems - Added working
htmlandhttp.clientbackported modules
- v0.3.0:
- Generalized import hooks to allow dotted imports
- Added backports of
urllib,html,httpmodules from Py3.3 stdlib usingfuture - Added
futurizescript for automatically turning Py2 or Py3 modules into cross-platform Py3 modules - Renamed
future.standard_library_renamestofuture.standard_library. (No longer just renames, but backports too.)
- v0.2.2.1:
- Small bug fixes to get tests passing on travis-ci.org
- v0.2.1:
- Small bug fixes
- v0.2.0:
Features module renamed to modified_builtins
New functions added: :func:`round`, :func:`input`
No more namespace pollution as a policy:
from future import *
should have no effect on Python 3. On Python 2, it only shadows the builtins; it doesn't introduce any new names.
End-to-end tests with Python 2 code and 2to3 now work
- v0.1.0:
- first version with tests!
- removed the inspect-module magic
- v0.0.x:
- initial releases. Use at your peril.