Skip to content

Commit d2cde87

Browse files
committed
PYTHON-665 Drop support for Python 2.4, 2.5, and 3.1
If you need to continue to use any of these Python versions with MongoDB the 2.x branch of PyMongo will continue to be minimally maintained for some time.
1 parent c9f0e89 commit d2cde87

File tree

5 files changed

+91
-87
lines changed

5 files changed

+91
-87
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ Dependencies
5858
============
5959

6060
The PyMongo distribution is supported and tested on Python 2.x (where
61-
x >= 4) and Python 3.x (where x >= 1). PyMongo versions <= 1.3 also
62-
supported Python 2.3, but that is no longer supported.
61+
x >= 6) and Python 3.x (where x >= 2). PyMongo versions before 3.0 also
62+
support Python 2.4, 2.5, and 3.1.
6363

6464
Additional dependencies are:
6565

doc/changelog.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Changelog
22
=========
33

4+
Changes in Version 3.0
5+
----------------------
6+
7+
.. warning:: PyMongo no longer supports Python 2.4, 2.5, or 3.1. If you
8+
must use PyMongo with these versions of Python the 2.x branch of PyMongo
9+
will be minimally supported for some time.
10+
11+
Issues Resolved
12+
...............
13+
14+
See the `PyMongo 3.0 release notes in JIRA`_ for the list of resolved issues
15+
in this release.
16+
17+
.. _PyMongo 3.0 release notes in JIRA: https://jira.mongodb.org/browse/PYTHON/fixforversion/12501
18+
419
Changes in Version 2.7
520
----------------------
621

doc/faq.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ connection pool per server in your replica set.
8383
Does PyMongo support Python 3?
8484
------------------------------
8585

86-
Starting with version 2.2 PyMongo supports Python 3.x where x >= 1. See the
87-
:doc:`python3` for details.
86+
PyMongo supports Python 3.x where x >= 2. See the :doc:`python3` for details.
8887

8988
Does PyMongo support asynchronous frameworks like Gevent, Tornado, or Twisted?
9089
------------------------------------------------------------------------------

doc/python3.rst

Lines changed: 71 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ Python 3 FAQ
66
What Python 3 versions are supported?
77
-------------------------------------
88

9-
PyMongo supports Python 3.x where x >= 1.
10-
11-
We **do not** support Python 3.0.x. It has many problems
12-
(some that directly impact PyMongo) and was `end-of-lifed`_
13-
with the release of Python 3.1.
14-
15-
.. _end-of-lifed: http://www.python.org/download/releases/3.0.1/
9+
PyMongo supports Python 3.x where x >= 2.
1610

1711
Are there any PyMongo behavior changes with Python 3?
1812
-----------------------------------------------------
@@ -26,8 +20,8 @@ with subtype 0.
2620
For example, let's insert a :class:`bytes` instance using Python 3 then
2721
read it back. Notice the byte string is decoded back to :class:`bytes`::
2822

29-
Python 3.1.4 (default, Mar 21 2012, 14:34:01)
30-
[GCC 4.5.3] on linux2
23+
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
24+
[GCC 4.7.3] on linux2
3125
Type "help", "copyright", "credits" or "license" for more information.
3226
>>> import pymongo
3327
>>> c = pymongo.MongoClient()
@@ -39,8 +33,8 @@ read it back. Notice the byte string is decoded back to :class:`bytes`::
3933
Now retrieve the same document in Python 2. Notice the byte string is decoded
4034
to :class:`~bson.binary.Binary`::
4135

42-
Python 2.7.3 (default, Apr 12 2012, 10:35:17)
43-
[GCC 4.5.3] on linux2
36+
Python 2.7.6 (default, Feb 26 2014, 10:36:22)
37+
[GCC 4.7.3] on linux2
4438
Type "help", "copyright", "credits" or "license" for more information.
4539
>>> import pymongo
4640
>>> c = pymongo.MongoClient()
@@ -60,75 +54,75 @@ need to unpickle them in Python 2.
6054
If you pickled an ObjectId using Python 2 and want to unpickle it using
6155
Python 3 you must pass ``encoding='latin-1'`` to pickle.loads::
6256

63-
Python 2.7.3 (default, Apr 12 2012, 10:35:17)
64-
[GCC 4.5.3] on linux2
65-
Type "help", "copyright", "credits" or "license" for more information.
66-
>>> import pickle
67-
>>> from bson.objectid import ObjectId
68-
>>> oid = ObjectId()
69-
>>> oid
70-
ObjectId('4f919ba2fba5225b84000000')
71-
>>> pickle.dumps(oid)
72-
'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...'
73-
74-
Python 3.1.4 (default, Mar 21 2012, 14:34:01)
75-
[GCC 4.5.3] on linux2
76-
Type "help", "copyright", "credits" or "license" for more information.
77-
>>> import pickle
78-
>>> pickle.loads(b'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...', encoding='latin-1')
79-
ObjectId('4f919ba2fba5225b84000000')
57+
Python 2.7.6 (default, Feb 26 2014, 10:36:22)
58+
[GCC 4.7.3] on linux2
59+
Type "help", "copyright", "credits" or "license" for more information.
60+
>>> import pickle
61+
>>> from bson.objectid import ObjectId
62+
>>> oid = ObjectId()
63+
>>> oid
64+
ObjectId('4f919ba2fba5225b84000000')
65+
>>> pickle.dumps(oid)
66+
'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...'
67+
68+
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
69+
[GCC 4.7.3] on linux2
70+
Type "help", "copyright", "credits" or "license" for more information.
71+
>>> import pickle
72+
>>> pickle.loads(b'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...', encoding='latin-1')
73+
ObjectId('4f919ba2fba5225b84000000')
8074

8175

8276
If you need to pickle ObjectIds using Python 3 and unpickle them using Python 2
8377
you must use Python 3.2.3 or newer and ``protocol <= 2``::
8478

85-
Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50)
86-
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
87-
Type "help", "copyright", "credits" or "license" for more information.
88-
>>> import pickle
89-
>>> from bson.objectid import ObjectId
90-
>>> oid = ObjectId()
91-
>>> oid
92-
ObjectId('4f96f20c430ee6bd06000000')
93-
>>> pickle.dumps(oid, protocol=2)
94-
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...'
95-
96-
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
97-
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
98-
Type "help", "copyright", "credits" or "license" for more information.
99-
>>> import pickle
100-
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...')
101-
ObjectId('4f96f20c430ee6bd06000000')
79+
Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50)
80+
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
81+
Type "help", "copyright", "credits" or "license" for more information.
82+
>>> import pickle
83+
>>> from bson.objectid import ObjectId
84+
>>> oid = ObjectId()
85+
>>> oid
86+
ObjectId('4f96f20c430ee6bd06000000')
87+
>>> pickle.dumps(oid, protocol=2)
88+
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...'
89+
90+
Python 2.6.9 (unknown, Feb 26 2014, 12:39:10)
91+
[GCC 4.7.3] on linux2
92+
Type "help", "copyright", "credits" or "license" for more information.
93+
>>> import pickle
94+
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...')
95+
ObjectId('4f96f20c430ee6bd06000000')
10296

10397

10498
Unfortunately this won't work if you pickled the ObjectId using a Python 3
10599
version older than 3.2.3::
106100

107-
Python 3.2.2 (default, Mar 21 2012, 14:32:23)
108-
[GCC 4.5.3] on linux2
109-
Type "help", "copyright", "credits" or "license" for more information.
110-
>>> import pickle
111-
>>> from bson.objectid import ObjectId
112-
>>> oid = ObjectId()
113-
>>> pickle.dumps(oid, protocol=2)
114-
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...'
115-
116-
Python 2.4.6 (#1, Apr 12 2012, 14:48:24)
117-
[GCC 4.5.3] on linux3
118-
Type "help", "copyright", "credits" or "license" for more information.
119-
>>> import pickle
120-
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...')
121-
Traceback (most recent call last):
122-
File "<stdin>", line 1, in ?
123-
File "/usr/lib/python2.4/pickle.py", line 1394, in loads
124-
return Unpickler(file).load()
125-
File "/usr/lib/python2.4/pickle.py", line 872, in load
126-
dispatch[key](self)
127-
File "/usr/lib/python2.4/pickle.py", line 1104, in load_global
128-
klass = self.find_class(module, name)
129-
File "/usr/lib/python2.4/pickle.py", line 1140, in find_class
130-
klass = getattr(mod, name)
131-
AttributeError: 'module' object has no attribute 'bytes'
101+
Python 3.2.2 (default, Mar 21 2012, 14:32:23)
102+
[GCC 4.5.3] on linux2
103+
Type "help", "copyright", "credits" or "license" for more information.
104+
>>> import pickle
105+
>>> from bson.objectid import ObjectId
106+
>>> oid = ObjectId()
107+
>>> pickle.dumps(oid, protocol=2)
108+
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...'
109+
110+
Python 2.4.6 (#1, Apr 12 2012, 14:48:24)
111+
[GCC 4.5.3] on linux3
112+
Type "help", "copyright", "credits" or "license" for more information.
113+
>>> import pickle
114+
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...')
115+
Traceback (most recent call last):
116+
File "<stdin>", line 1, in ?
117+
File "/usr/lib/python2.4/pickle.py", line 1394, in loads
118+
return Unpickler(file).load()
119+
File "/usr/lib/python2.4/pickle.py", line 872, in load
120+
dispatch[key](self)
121+
File "/usr/lib/python2.4/pickle.py", line 1104, in load_global
122+
klass = self.find_class(module, name)
123+
File "/usr/lib/python2.4/pickle.py", line 1140, in find_class
124+
klass = getattr(mod, name)
125+
AttributeError: 'module' object has no attribute 'bytes'
132126

133127
.. warning::
134128

@@ -151,15 +145,15 @@ directory after running ``python setup.py install`` the untranslated modules
151145
will be the first thing in your path. Importing pymongo will result in an
152146
exception similar to::
153147

154-
Python 3.1.5 (default, Jun 2 2012, 12:24:49)
155-
[GCC 4.6.3] on linux2
148+
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
149+
[GCC 4.7.3] on linux2
156150
Type "help", "copyright", "credits" or "license" for more information.
157151
>>> import pymongo
158152
Traceback (most recent call last):
159153
File "<stdin>", line 1, in <module>
160-
File "pymongo/__init__.py", line 58, in <module>
154+
File "pymongo/__init__.py", line 77, in <module>
161155
version = get_version_string()
162-
File "pymongo/__init__.py", line 54, in get_version_string
156+
File "pymongo/__init__.py", line 73, in get_version_string
163157
if isinstance(version_tuple[-1], basestring):
164158
NameError: global name 'basestring' is not defined
165159

@@ -168,11 +162,11 @@ source directory takes the untranslated modules out of your path::
168162

169163
$ cd ..
170164
$ python
171-
Python 3.1.5 (default, Jun 2 2012, 12:24:49)
172-
[GCC 4.6.3] on linux2
165+
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
166+
[GCC 4.7.3] on linux2
173167
Type "help", "copyright", "credits" or "license" for more information.
174168
>>> import pymongo
175169
>>> pymongo.__file__
176-
'/home/behackett/py3k/lib/python3.1/site-packages/pymongo-2.2-py3.1-linux-x86_64.egg/pymongo/__init__.py'
170+
'/home/behackett/py3k/lib/python3.2/site-packages/pymongo-2.7-py3.2-linux-x86_64.egg/pymongo/__init__.py'
177171

178172

setup.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def set_nose_options(self):
204204

205205
def build_extension(self, ext):
206206
name = ext.name
207-
if sys.version_info[:3] >= (2, 4, 0):
207+
if sys.version_info[:3] >= (2, 6, 0):
208208
try:
209209
build_ext.build_extension(self, ext)
210210
if should_run_tests:
@@ -221,7 +221,7 @@ def build_extension(self, ext):
221221
else:
222222
warnings.warn(self.warning_message % ("The %s extension "
223223
"module" % (name,),
224-
"Please use Python >= 2.4 "
224+
"Please use Python >= 2.6 "
225225
"to take advantage of the "
226226
"extension."))
227227

@@ -308,17 +308,13 @@ def build_extension(self, ext):
308308
"Operating System :: Microsoft :: Windows",
309309
"Operating System :: POSIX",
310310
"Programming Language :: Python :: 2",
311-
"Programming Language :: Python :: 2.4",
312-
"Programming Language :: Python :: 2.5",
313311
"Programming Language :: Python :: 2.6",
314312
"Programming Language :: Python :: 2.7",
315313
"Programming Language :: Python :: 3",
316-
"Programming Language :: Python :: 3.1",
317314
"Programming Language :: Python :: 3.2",
318315
"Programming Language :: Python :: 3.3",
319316
"Programming Language :: Python :: 3.4",
320317
"Programming Language :: Python :: Implementation :: CPython",
321-
"Programming Language :: Python :: Implementation :: Jython",
322318
"Programming Language :: Python :: Implementation :: PyPy",
323319
"Topic :: Database"],
324320
cmdclass={"build_ext": custom_build_ext,

0 commit comments

Comments
 (0)