Skip to content

Commit bd4381d

Browse files
committed
Remove configparser alias package (issue #118)
1 parent 4a8f545 commit bd4381d

File tree

11 files changed

+47
-36
lines changed

11 files changed

+47
-36
lines changed

docs/compatible_idioms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ configparser
14131413
# Python 2 only:
14141414
from ConfigParser import ConfigParser
14151415
1416-
# Python 2 and 3 (after ``pip install future``):
1416+
# Python 2 and 3 (after ``pip install configparser``):
14171417
from configparser import ConfigParser
14181418
queue
14191419
~~~~~

docs/pasteurize.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Running ``pasteurize -w mypy3module.py`` turns this Python 3 code::
77
88
import configparser
9+
import copyreg
910
1011
class Blah:
1112
pass
@@ -18,6 +19,7 @@ into this code which runs on both Py2 and Py3::
1819
standard_library.install_hooks()
1920
2021
import configparser
22+
import copyreg
2123

2224
class Blah(object):
2325
pass
@@ -27,6 +29,13 @@ Notice that both ``futurize`` and ``pasteurize`` create explicit new-style
2729
classes that inherit from ``object`` on both Python versions, and both
2830
refer to stdlib modules (as well as builtins) under their Py3 names.
2931

32+
Note also that the ``configparser`` module is a special case; there is a full
33+
backport available on PyPI (https://pypi.python.org/pypi/configparser), so, as
34+
of v0.18.0, ``python-future`` no longer provides a ``configparser`` package
35+
alias. To use the resulting code on Py2, install the ``configparser`` backport
36+
with ``pip install configparser`` or by adding it to your ``requirements.txt``
37+
file.
38+
3039
``pasteurize`` also handles the following Python 3 features:
3140

3241
- keyword-only arguments
@@ -36,4 +45,3 @@ refer to stdlib modules (as well as builtins) under their Py3 names.
3645
To handle function annotations (PEP 3107), see :ref:`func_annotations`.
3746

3847

39-

docs/quickstart.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ to be accessed under their Python 3 names and locations in Python 2::
100100
# Then these Py3-style imports work on both Python 2 and Python 3:
101101
import socketserver
102102
import queue
103-
import configparser
104103
from collections import UserDict, UserList, UserString
105104
from collections import Counter, OrderedDict, ChainMap # even on Py2.6
106105
from itertools import filterfalse, zip_longest

docs/standard_library_imports.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,20 @@ Python 3 code runs unchanged on Python 2 after installing ``future``::
2424

2525
>>> # Top-level packages with Py3 names provided on Py2:
2626
>>> import queue
27-
>>> import configparser
2827
>>> import tkinter.dialog
2928
>>> etc.
3029

3130
Notice that this code actually runs on Python 3 without the presence of the
3231
``future`` package.
3332

3433
Of the 44 modules that were refactored with PEP 3108 (standard library
35-
reorganization), 30 are supported with direct imports in the above manner. The
34+
reorganization), 29 are supported with direct imports in the above manner. The
3635
complete list is here::
3736

3837
### Renamed modules:
3938

4039
import builtins
4140

42-
import configparser
4341
import copyreg
4442

4543
import html
@@ -79,6 +77,8 @@ complete list is here::
7977
import _markupbase
8078
import _thread
8179

80+
Note that, as of v0.18.0, ``python-future`` no longer includes an alias for the
81+
``configparser`` module because a full backport exists (see https://pypi.python.org/pypi/configparser).
8282

8383
.. _list-standard-library-refactored:
8484

docs/whatsnew.rst

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,30 @@
33
What's New
44
**********
55

6-
.. _whats-new-0.15.x:
6+
.. _whats-new-0.16.x:
77

8-
What's new in version 0.15.3 (2015-02-...)
8+
What's new in version 0.16.0 (2016-05-...)
99
==========================================
1010

11-
This is a minor bug-fix release:
12-
13-
- Fix ``newbytes`` constructor bug (issue #163)
14-
11+
This release removes the ``configparser`` package as an alias for
12+
``ConfigParser`` on Py2 to improve compatibility with the backported
13+
`configparser package <https://pypi.python.org/pypi/configparser>`. Previously
14+
``python-future`` and the PyPI ``configparser`` backport clashed, causing
15+
confusion and various compatibility issues. (Issue #118)
16+
17+
This warrants a new major version number for ``python-future`` because Py2/3
18+
code that uses `configparser` will no longer run on Py2 systems without the
19+
`configparser` backport installed. As an upgrade path, run ``pip install
20+
configparser`` or add ``configparser`` to your ``requirements.txt`` file.
21+
22+
This releases fixes these bugs:
23+
24+
- Fix ``newbytes`` constructor bug. (Issue #163)
25+
- Fix semantics of `bool()` with `newobject`. (Issue #211)
26+
- Fix `standard_library.install_aliases()` on PyPy. (Issue #205)
27+
- Fix assertRaises for `pow` and `compile` on Python 3.5. (Issue #183)
28+
- Fix return argument of `future.utils.ensure_new_type` if conversion to new type does not exist. (Issue #185)
29+
- Allow the `old_div` fixer to be disabled. (Issue #190)
1530

1631
What's new in version 0.15.2 (2015-09-11)
1732
=========================================

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
if sys.version_info[:2] < (3, 0):
5959
PACKAGES += [
6060
"builtins",
61-
"configparser",
61+
# "configparser", # removed in v0.18.0
6262
"copyreg",
6363
"html",
6464
"http",
@@ -125,7 +125,7 @@
125125
# If the user happens to run:
126126
# python2 setup.py build
127127
# python3 setup.py install
128-
# then folders like "configparser" will be in build/lib.
128+
# then folders like "copyreg" will be in build/lib.
129129
# If so, we CANNOT let the user install this, because
130130
# this may break his/her Python 3 install, depending on the folder order in
131131
# sys.path. (Running "import configparser" etc. may pick up our Py2
@@ -135,7 +135,7 @@
135135
'_markupbase',
136136
'_thread',
137137
'builtins',
138-
'configparser',
138+
# 'configparser',
139139
'copyreg',
140140
'html',
141141
'http',

src/configparser/__init__.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/future/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
following Py3 interfaces:
3232
3333
>>> # Top-level packages with Py3 names provided on Py2:
34-
>>> import configparser
3534
>>> import html.parser
3635
>>> import queue
3736
>>> import tkinter.dialog

src/future/standard_library/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
And then these normal Py3 imports work on both Py3 and Py2::
1212
1313
import builtins
14-
import configparser
1514
import copyreg
1615
import queue
1716
import reprlib
@@ -739,8 +738,9 @@ class exclude_local_folder_imports(object):
739738
A context-manager that prevents standard library modules like configparser
740739
from being imported from the local python-future source folder on Py3.
741740
742-
(The presence of a configparser folder would otherwise prevent setuptools
743-
from running on Py3.)
741+
(This was need prior to v0.18.0 because the presence of a configparser
742+
folder would otherwise have prevented setuptools from running on Py3. Maybe
743+
it's not needed any more?)
744744
"""
745745
def __init__(self, *args):
746746
assert len(args) > 0

tests/test_future/test_futurize.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ def test_renamed_modules(self):
631631
import pickle
632632
import io
633633
"""
634-
self.convert_check(before, after)
634+
# We can't run the converted code because configparser may
635+
# not be there.
636+
self.convert_check(before, after, run=False)
635637

636638
@unittest.skip('Not working yet ...')
637639
def test_urllib_refactor(self):

0 commit comments

Comments
 (0)