basho/riak-python-client — pull request #379 by javajolt (2014-11-13 00:26:11+00:00)
Title: Add Support for Python 3

This is a wide-sweeping change which allows the Python client to run on these versions:
* 2.6.9
* 2.7.8
* 3.3.6
* 3.4.2

The ``six`` module is critical in supporting both Python 2 and Python 3 and is used whenever appropriate.
In other places conditions have been added with the ``six.PY2`` and ``six.PY3`` constants to run the appropriate code.

Here are a few changes from Python 2 to 3 which were addressed:
* ``print`` is now a function
* Relative module pathnames are no longer supported
* All strings are now Unicode by default
* PBC library requires binary (``bytes``) instead of strings
* ``dict``s return iterators, not lists in iterable contexts
* ``long`` type has been deprecated and ``int`` is now 64-bit
* Libraries have been reorganized, especially HTTP and exceptions, so imports have changed
* ``next()`` in the iterable interface is now ``__next()__``
* Socket library is greatly different, so for security the native ``ssl`` library is used instead of ``PyOpenSSL`` to support HTTP
* Python 3.3 ``ssl`` library is not as mature as Python 3.4 so lacks a few features (like TLS 1.2)
* Python 3 ``ssl`` library only allows certificate files, not bytes treams, to be added so the ``SecurityCreds`` class does not support cached files like it does in Python 2
* Some unit test assertions were renamed, so ``test_six.py`` was introduced to hand the renames
* ``xrange()`` was retired so ``range()`` was used in its stead
* Tests for ``riak_object`` were adjusted in Python 3 since strings need to be encoded before sent to the transport layer
* The built-in unit tests in Python 3.4.2 actually don't test CRLs, so for now they are not supported in Python 3.x client
* Python 3 client supports Unicode key and bucket names, unlike Python 2
* The file ``open`` interface changed slightly

NOTE: This PR is dependent upon ``riak_pb`` https://github.com/basho/riak_pb/pull/104