-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for Python 3 #379
Conversation
@@ -104,13 +104,17 @@ def next(self): | |||
else: | |||
if self.rehearse: | |||
gc.collect() | |||
print ("-" * 59) | |||
print("-" * 59) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For safety, shouldn't the Python 2 version from __future__ import print_function
?
- actually return from __next()__ - use isinstance instead == to determine object type - import print_function from __future__ for Python 2 - port assertItemsEqual() from Python2 to Python3 - actually run the YZ tests 😲
702cb3e
to
5b006f7
Compare
@@ -1,12 +1,21 @@ | |||
#!/usr/bin/env python | |||
import platform | |||
from six import PY2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not having this installed was my first roadblock, and there doesn't seem to be anything that requires it in the setup file, commands or version. Since this is only used to detect Python 2, can you change it to the simpler version like on line 20?
It'd be reasonable to include it as a dependency in the package, however, since it's used in so many places.
👍 533aea5 |
Add Support for Python 3 Reviewed-by: seancribbs
@borshop merge |
This is a wide-sweeping change which allows the Python client to run on these versions:
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
andsix.PY3
constants to run the appropriate code.Here are a few changes from Python 2 to 3 which were addressed:
print
is now a functionbytes
) instead of stringsdict
s return iterators, not lists in iterable contextslong
type has been deprecated andint
is now 64-bitnext()
in the iterable interface is now__next()__
ssl
library is used instead ofPyOpenSSL
to support HTTPssl
library is not as mature as Python 3.4 so lacks a few features (like TLS 1.2)ssl
library only allows certificate files, not bytes treams, to be added so theSecurityCreds
class does not support cached files like it does in Python 2test_six.py
was introduced to hand the renamesxrange()
was retired sorange()
was used in its steadriak_object
were adjusted in Python 3 since strings need to be encoded before sent to the transport layeropen
interface changed slightlyNOTE: This PR is dependent upon
riak_pb
basho/riak_pb#104