Add support for Python 3.x
Currently we only support Python 2.7, but we should support Python 3.
Main things this involves: print -> print(), handle __floordiv__ / __truediv__ / __div__ correctly.
:+1: to this issue
:+1:
:+1:
:+1:
We're working on it.
Python 3 is a must have. :+1:
How do we contribute towards python3 support? Are there any specific tickets open? Is there a python3 development branch?
@mgcdanny seems they require contributors to sign an agreement first. https://github.com/tensorflow/tensorflow/blob/master/CONTRIBUTING.md
:+1:
I'm running futurize on the code at the moment; once that's done it'll be easier to parallelize the remaining work. So far futurize --stage1 is checked in and I'm working through futurize --stage2 now (checking each of our divisions very carefully :)).
Unfortunately our contribution process needs a bit of improvement (we're working on streamlining it), but I'll see if there are natural chunks of work to break off and ask for help in fixing once the initial futurize push is done. Before that it's tricky to parallelize.
The only non-obvious questions (so far) are what to do with unicode and where. Cc'ing @mrry since he was taking a look at that. Most of the "names" for things, such as names for ops and names for tensors in a graph, are already restricted to be roughly alphanumeric, so hopefully we should be able to leave them as C++ string while still accepting unicode input from Python.
Also, question for people that have done such conversions before / recently: is six still the recommended way to make code transparently support both? In particular, we need stuff like xrange and iteritems as symbols that exist in both 2.7 and 3.x.
@girving I would follow the guide written by python3 core dev Brett Cannon: https://docs.python.org/3.5/howto/pyporting.html. He's been heavily involved with the push to move existing libs to python3.
@madisonmay: Thanks, should have asked you earlier. Modernize probably would have been a better choice, since after reading that page I am essentially taking the output of futurize and then rewriting it into what modernize might have already spit out. Mostly done with that phase, though, so I'll probably just finish it up using futurize.
For the record: futurize --stage was mostly print_function and a few other safe trivialities. I'll write a detailed comment on what futurize --stage2 involved for us once I'm done with it (still in the middle of reading diffs).
+1
I think it is pretty clear that there are many people interested in this issue. However, I would suggest users to use the Subscribe button instead of adding a new :+1:.

This way developers (and all subscribed users) can get notifications on useful future updates. :wink:
PS: If you already posted a :+1: you might as well consider removing it to keep the discussion cleaner.
Thank you @Peque! It would be great if further comments were limited to technical discussions about Python 3 support.
From the README:
The TensorFlow Python API currently requires Python 2.7: we are working on adding support for Python 3.0.
If you require 2.7 for the 2.X line, then why restrict yourselves to 3.0 (which was released about the time of 2.6)? If you target 3.3+, then you'll save yourselves a lot of headache, especially if you're using u'あ' unicode strings. (also see unicode_literals).
And :+1: for six for more complicated things.
Sorry, I meant Python 3, not 3.0 -- was in a rush to fix :P. I'll fix this today
@goodmami: Yes, we will likely only support 3.3+, possibly 3.4+ (I'm not sure what the differences are, but will look that up). I also changed the issue title.