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.
This commit is contained in:
parent
c9f0e89127
commit
d2cde8719a
@ -58,8 +58,8 @@ Dependencies
|
||||
============
|
||||
|
||||
The PyMongo distribution is supported and tested on Python 2.x (where
|
||||
x >= 4) and Python 3.x (where x >= 1). PyMongo versions <= 1.3 also
|
||||
supported Python 2.3, but that is no longer supported.
|
||||
x >= 6) and Python 3.x (where x >= 2). PyMongo versions before 3.0 also
|
||||
support Python 2.4, 2.5, and 3.1.
|
||||
|
||||
Additional dependencies are:
|
||||
|
||||
|
||||
@ -1,6 +1,21 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Changes in Version 3.0
|
||||
----------------------
|
||||
|
||||
.. warning:: PyMongo no longer supports Python 2.4, 2.5, or 3.1. If you
|
||||
must use PyMongo with these versions of Python the 2.x branch of PyMongo
|
||||
will be minimally supported for some time.
|
||||
|
||||
Issues Resolved
|
||||
...............
|
||||
|
||||
See the `PyMongo 3.0 release notes in JIRA`_ for the list of resolved issues
|
||||
in this release.
|
||||
|
||||
.. _PyMongo 3.0 release notes in JIRA: https://jira.mongodb.org/browse/PYTHON/fixforversion/12501
|
||||
|
||||
Changes in Version 2.7
|
||||
----------------------
|
||||
|
||||
|
||||
@ -83,8 +83,7 @@ connection pool per server in your replica set.
|
||||
Does PyMongo support Python 3?
|
||||
------------------------------
|
||||
|
||||
Starting with version 2.2 PyMongo supports Python 3.x where x >= 1. See the
|
||||
:doc:`python3` for details.
|
||||
PyMongo supports Python 3.x where x >= 2. See the :doc:`python3` for details.
|
||||
|
||||
Does PyMongo support asynchronous frameworks like Gevent, Tornado, or Twisted?
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
142
doc/python3.rst
142
doc/python3.rst
@ -6,13 +6,7 @@ Python 3 FAQ
|
||||
What Python 3 versions are supported?
|
||||
-------------------------------------
|
||||
|
||||
PyMongo supports Python 3.x where x >= 1.
|
||||
|
||||
We **do not** support Python 3.0.x. It has many problems
|
||||
(some that directly impact PyMongo) and was `end-of-lifed`_
|
||||
with the release of Python 3.1.
|
||||
|
||||
.. _end-of-lifed: http://www.python.org/download/releases/3.0.1/
|
||||
PyMongo supports Python 3.x where x >= 2.
|
||||
|
||||
Are there any PyMongo behavior changes with Python 3?
|
||||
-----------------------------------------------------
|
||||
@ -26,8 +20,8 @@ with subtype 0.
|
||||
For example, let's insert a :class:`bytes` instance using Python 3 then
|
||||
read it back. Notice the byte string is decoded back to :class:`bytes`::
|
||||
|
||||
Python 3.1.4 (default, Mar 21 2012, 14:34:01)
|
||||
[GCC 4.5.3] on linux2
|
||||
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
|
||||
[GCC 4.7.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pymongo
|
||||
>>> c = pymongo.MongoClient()
|
||||
@ -39,8 +33,8 @@ read it back. Notice the byte string is decoded back to :class:`bytes`::
|
||||
Now retrieve the same document in Python 2. Notice the byte string is decoded
|
||||
to :class:`~bson.binary.Binary`::
|
||||
|
||||
Python 2.7.3 (default, Apr 12 2012, 10:35:17)
|
||||
[GCC 4.5.3] on linux2
|
||||
Python 2.7.6 (default, Feb 26 2014, 10:36:22)
|
||||
[GCC 4.7.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pymongo
|
||||
>>> c = pymongo.MongoClient()
|
||||
@ -60,75 +54,75 @@ need to unpickle them in Python 2.
|
||||
If you pickled an ObjectId using Python 2 and want to unpickle it using
|
||||
Python 3 you must pass ``encoding='latin-1'`` to pickle.loads::
|
||||
|
||||
Python 2.7.3 (default, Apr 12 2012, 10:35:17)
|
||||
[GCC 4.5.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> from bson.objectid import ObjectId
|
||||
>>> oid = ObjectId()
|
||||
>>> oid
|
||||
ObjectId('4f919ba2fba5225b84000000')
|
||||
>>> pickle.dumps(oid)
|
||||
'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...'
|
||||
Python 2.7.6 (default, Feb 26 2014, 10:36:22)
|
||||
[GCC 4.7.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> from bson.objectid import ObjectId
|
||||
>>> oid = ObjectId()
|
||||
>>> oid
|
||||
ObjectId('4f919ba2fba5225b84000000')
|
||||
>>> pickle.dumps(oid)
|
||||
'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...'
|
||||
|
||||
Python 3.1.4 (default, Mar 21 2012, 14:34:01)
|
||||
[GCC 4.5.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> pickle.loads(b'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...', encoding='latin-1')
|
||||
ObjectId('4f919ba2fba5225b84000000')
|
||||
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
|
||||
[GCC 4.7.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> pickle.loads(b'ccopy_reg\n_reconstructor\np0\n(cbson.objectid\...', encoding='latin-1')
|
||||
ObjectId('4f919ba2fba5225b84000000')
|
||||
|
||||
|
||||
If you need to pickle ObjectIds using Python 3 and unpickle them using Python 2
|
||||
you must use Python 3.2.3 or newer and ``protocol <= 2``::
|
||||
|
||||
Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50)
|
||||
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> from bson.objectid import ObjectId
|
||||
>>> oid = ObjectId()
|
||||
>>> oid
|
||||
ObjectId('4f96f20c430ee6bd06000000')
|
||||
>>> pickle.dumps(oid, protocol=2)
|
||||
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...'
|
||||
Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50)
|
||||
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> from bson.objectid import ObjectId
|
||||
>>> oid = ObjectId()
|
||||
>>> oid
|
||||
ObjectId('4f96f20c430ee6bd06000000')
|
||||
>>> pickle.dumps(oid, protocol=2)
|
||||
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...'
|
||||
|
||||
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
|
||||
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...')
|
||||
ObjectId('4f96f20c430ee6bd06000000')
|
||||
Python 2.6.9 (unknown, Feb 26 2014, 12:39:10)
|
||||
[GCC 4.7.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c_codecs\nencode\...')
|
||||
ObjectId('4f96f20c430ee6bd06000000')
|
||||
|
||||
|
||||
Unfortunately this won't work if you pickled the ObjectId using a Python 3
|
||||
version older than 3.2.3::
|
||||
|
||||
Python 3.2.2 (default, Mar 21 2012, 14:32:23)
|
||||
[GCC 4.5.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> from bson.objectid import ObjectId
|
||||
>>> oid = ObjectId()
|
||||
>>> pickle.dumps(oid, protocol=2)
|
||||
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...'
|
||||
Python 3.2.2 (default, Mar 21 2012, 14:32:23)
|
||||
[GCC 4.5.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> from bson.objectid import ObjectId
|
||||
>>> oid = ObjectId()
|
||||
>>> pickle.dumps(oid, protocol=2)
|
||||
b'\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...'
|
||||
|
||||
Python 2.4.6 (#1, Apr 12 2012, 14:48:24)
|
||||
[GCC 4.5.3] on linux3
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...')
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in ?
|
||||
File "/usr/lib/python2.4/pickle.py", line 1394, in loads
|
||||
return Unpickler(file).load()
|
||||
File "/usr/lib/python2.4/pickle.py", line 872, in load
|
||||
dispatch[key](self)
|
||||
File "/usr/lib/python2.4/pickle.py", line 1104, in load_global
|
||||
klass = self.find_class(module, name)
|
||||
File "/usr/lib/python2.4/pickle.py", line 1140, in find_class
|
||||
klass = getattr(mod, name)
|
||||
AttributeError: 'module' object has no attribute 'bytes'
|
||||
Python 2.4.6 (#1, Apr 12 2012, 14:48:24)
|
||||
[GCC 4.5.3] on linux3
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pickle
|
||||
>>> pickle.loads('\x80\x02cbson.objectid\nObjectId\nq\x00)\x81q\x01c__builtin__\nbytes\...')
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in ?
|
||||
File "/usr/lib/python2.4/pickle.py", line 1394, in loads
|
||||
return Unpickler(file).load()
|
||||
File "/usr/lib/python2.4/pickle.py", line 872, in load
|
||||
dispatch[key](self)
|
||||
File "/usr/lib/python2.4/pickle.py", line 1104, in load_global
|
||||
klass = self.find_class(module, name)
|
||||
File "/usr/lib/python2.4/pickle.py", line 1140, in find_class
|
||||
klass = getattr(mod, name)
|
||||
AttributeError: 'module' object has no attribute 'bytes'
|
||||
|
||||
.. warning::
|
||||
|
||||
@ -151,15 +145,15 @@ directory after running ``python setup.py install`` the untranslated modules
|
||||
will be the first thing in your path. Importing pymongo will result in an
|
||||
exception similar to::
|
||||
|
||||
Python 3.1.5 (default, Jun 2 2012, 12:24:49)
|
||||
[GCC 4.6.3] on linux2
|
||||
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
|
||||
[GCC 4.7.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pymongo
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
File "pymongo/__init__.py", line 58, in <module>
|
||||
File "pymongo/__init__.py", line 77, in <module>
|
||||
version = get_version_string()
|
||||
File "pymongo/__init__.py", line 54, in get_version_string
|
||||
File "pymongo/__init__.py", line 73, in get_version_string
|
||||
if isinstance(version_tuple[-1], basestring):
|
||||
NameError: global name 'basestring' is not defined
|
||||
|
||||
@ -168,11 +162,11 @@ source directory takes the untranslated modules out of your path::
|
||||
|
||||
$ cd ..
|
||||
$ python
|
||||
Python 3.1.5 (default, Jun 2 2012, 12:24:49)
|
||||
[GCC 4.6.3] on linux2
|
||||
Python 3.2.5 (default, Feb 26 2014, 12:40:25)
|
||||
[GCC 4.7.3] on linux2
|
||||
Type "help", "copyright", "credits" or "license" for more information.
|
||||
>>> import pymongo
|
||||
>>> pymongo.__file__
|
||||
'/home/behackett/py3k/lib/python3.1/site-packages/pymongo-2.2-py3.1-linux-x86_64.egg/pymongo/__init__.py'
|
||||
'/home/behackett/py3k/lib/python3.2/site-packages/pymongo-2.7-py3.2-linux-x86_64.egg/pymongo/__init__.py'
|
||||
|
||||
|
||||
|
||||
8
setup.py
8
setup.py
@ -204,7 +204,7 @@ http://api.mongodb.org/python/current/installation.html#osx
|
||||
|
||||
def build_extension(self, ext):
|
||||
name = ext.name
|
||||
if sys.version_info[:3] >= (2, 4, 0):
|
||||
if sys.version_info[:3] >= (2, 6, 0):
|
||||
try:
|
||||
build_ext.build_extension(self, ext)
|
||||
if should_run_tests:
|
||||
@ -221,7 +221,7 @@ http://api.mongodb.org/python/current/installation.html#osx
|
||||
else:
|
||||
warnings.warn(self.warning_message % ("The %s extension "
|
||||
"module" % (name,),
|
||||
"Please use Python >= 2.4 "
|
||||
"Please use Python >= 2.6 "
|
||||
"to take advantage of the "
|
||||
"extension."))
|
||||
|
||||
@ -308,17 +308,13 @@ setup(
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Operating System :: POSIX",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.4",
|
||||
"Programming Language :: Python :: 2.5",
|
||||
"Programming Language :: Python :: 2.6",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.1",
|
||||
"Programming Language :: Python :: 3.2",
|
||||
"Programming Language :: Python :: 3.3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: Implementation :: Jython",
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
"Topic :: Database"],
|
||||
cmdclass={"build_ext": custom_build_ext,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user