You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Note: backwards-incompatible change:* As previously announced (see
17
+
**Note: backwards-incompatible change:** As previously announced (see
18
18
:ref:`deprecated-auto-import-hooks`), the import hooks must now be enabled
19
19
explicitly, as follows::
20
20
@@ -26,10 +26,12 @@ explicitly, as follows::
26
26
27
27
This now causes these modules to be imported from ``future.moves``, a new
28
28
package that provides wrappers over the native Python 2 standard library with
29
-
the new Python 3 organization.
29
+
the new Python 3 organization. As a consequence, the import hooks provided in
30
+
``future.standard_library`` are now fully compatible with the `Requests library
31
+
<http://python-requests.org>`_.
30
32
31
-
The functional interface is now deprecated but still supported for backwards
32
-
compatibility::
33
+
The functional interface with ``install_hooks()`` is still supported for
34
+
backwards compatibility::
33
35
34
36
from future import standard_library
35
37
standard_library.install_hooks():
@@ -39,49 +41,10 @@ compatibility::
39
41
...
40
42
standard_library.remove_hooks()
41
43
42
-
This allows finer-grained control over whether import hooks are enabled for
43
-
other imported modules, such as ``requests``, which provide their own Python
44
-
2/3 compatibility code. This also improves compatibility of ``future`` with
45
-
tools like ``py2exe``.
46
-
47
-
48
-
.. Versioned standard library imports
49
-
.. ----------------------------------
50
-
..
51
-
.. ``future`` now offers a choice of either backported versions of the standard library modules from Python 3.3 or renamed Python 2.7 versions. Use it as follows::
52
-
..
53
-
.. from future import standard_library
54
-
.. standard_library.install_hooks(version='3.3')
55
-
.. import html.parser
56
-
.. ...
57
-
.. standard_library.remove_hooks()
58
-
..
59
-
.. or as follows::
60
-
..
61
-
.. from future import standard_library
62
-
.. with standard_library.hooks(version='2.7'):
63
-
.. import html.parser
64
-
.. ...
65
-
..
66
-
.. If ``version='2.7'`` is selected, on Python 2.7 the import hooks provide an interface to the
67
-
.. Python 2.7 standard library modules remapped to their equivalent Python 3.x names. For example, the above code is equivalent to this on Python 2.7 (more or less)::
0 commit comments