Python 3 #3

Closed
rozling opened this Issue May 6, 2014 · 87 comments

Projects

None yet
@rozling
rozling commented May 6, 2014

Request for Python 3 support (continuing on from https://code.google.com/p/google-api-python-client/issues/detail?id=57). My use case is for using the popular editor Sublime Text 3 to interact with the Google API.

@craigcitro
Member

This is on our radar, but we don't have any concrete plans right now. I'm going to tag this "enhancement" for now, so people don't keep reopening.

@ianjosephwilson

I also need python3 support since I started a project with python3 and now I want google+ sigin and access to google contacts. Here is the google document which lists the google api python client as needed for the g+ signin implementation, see step 8: https://developers.google.com/+/web/signin/server-side-flow

It seems that there are two strategies:

  1. separate code bases for python2 and python3
    • here is a good implementation of that in one of this library's dependencies:
    • this is probably the safest approach if backwards compatibility is the number 1 concern
  2. combined code base that supports both python2 and python3

It seems that no actual python dependency is listed for either google-api-python-client or oauth2client. The python documentation states that limiting support to Python 2.6+ will make strategy 2, a combined code base, easier:
https://docs.python.org/3/howto/pyporting.html#try-to-support-python-2-6-and-newer-only

Seeing python3 support as inevitable if a high level path is chosen now then others can start contributing.

@craigcitro
Member

@ianjosephwilson i'm with you that we ultimately want a plan for moving to python 3 -- it also has to include oauth2client, and any other moving parts underneath. i'm happy to kick around ideas, but we don't have any sort of timeframe in mind just yet.

@ianjosephwilson

@craigcitro I think same trick used in httplib2 could be used to choose the correct oauth2client lib if oauth2client used separate folders for python2 and python3. For example:

src_dir = 'python%s' % sys.version_info[0]
package_dir={
    'oauth2client':'oauth2client/' + src_dir + '/oauth2client',
    'uritemplate':'oauth2client/' + src_dir + /uritemplate',
}

So I don't think the embedding requirement will be limiting in choosing between strategies 1 and 2 I mentioned earlier.

What is the minimum python version that must be supported?

@craigcitro
Member

2.6 is fine for a minimum version.

@ianjosephwilson

Maybe updating each repo in place to work with both python 2.6+ and python 3.2+ would be the best option then, strategy 2.

Can a depedency on six be added? It is discussed in the python docs here: https://docs.python.org/3/howto/pyporting.html#projects-to-consider

@JelteF
JelteF commented Jun 8, 2014

There seems to be a python3 compatible unofficial clone: https://github.com/enorvelle/GoogleApiPython3x

@itbabu itbabu referenced this issue in itbabu/cmsplugin-googleplus Jun 22, 2014
Closed

Python 3 support #1

@esistgut

+1

@pferate pferate referenced this issue in google/oauth2client Jul 14, 2014
Closed

Python 3 #25

@dustinfarris

wait.. google doesn't support python3?

@JelteF
JelteF commented Aug 14, 2014

Yeah, it's ridiculous
On Aug 14, 2014 11:10 PM, "Dustin Farris" notifications@github.com wrote:

wait.. google doesn't support python3?

โ€”
Reply to this email directly or view it on GitHub
#3 (comment)
.

@slessans

its unbelievable. and theres not even concrete plans it seems like...

@dustinfarris

dammit, google ๐Ÿ‘Ž

@dustinfarris

Hah! From the Python example in their docs:

This document assumes that you have the latest version of Python installed

Not!

@craigcitro
Member

to anyone complaining we didn't already implement this: happy to look at pull requests. ;)

@ianjosephwilson we're making good progress on getting oauth2client updated for py3, and it looks like we're going to be able to do it with a single codebase (and no import magic). that's definitely the way i'd like to do it here, too, unless there's a reason i'm not seeing that it won't work.

@felagund felagund referenced this issue in googledrive/PyDrive Aug 26, 2014
Closed

Supports Python3? #15

@fake-name

+1 here as well. I'm trying to extract data from google docs.

@hyunwooj
hyunwooj commented Oct 9, 2014

+1

@troygrosfield

@craigcitro, you mentioned making good progress 3 months ago. Where does py3 support currently stand? No need to duplicate efforts. Is there a py3 branch being worked on?

@craigcitro
Member

oauth2client is now updated for python3. i've done no work on this repo.

@icoxfog417

I'm waiting python3 support too. Pull #25 offers the way to migrate python3.

@Alex3917

Just wanted to add that this is the only dependency in my application that doesn't support Python3, so any work done porting this would be much appreciated.

@chhantyal

+1 for Python 3 support.

@JavierGarciaD

+1 for Python 3 support.

@leto
leto commented Dec 4, 2014

๐Ÿ‘ for python support. I want to start a new project and this is the only dependency that requires Python 2

@victorhooi

For our particular use case, we're using the Gmail API and also interacting with JIRA behind SSL - this requires SNI, which Python 2.x doesn't support:

http://docs.python-requests.org/en/latest/community/faq/#what-are-hostname-doesn-t-match-errors

So yes, Python 3.x support would be fantastic for this issue (among all the other good reasons, of course).

Is there any update on this yet?

@FirefighterBlu3

given that python2 doesn't support SNI and google is planning on dropping all ssl3 support "real soon now", and forcing most (all) connections to be https, it's very important that we (when i say WE, i really mean GOOGLE because the other we -- aka devs, are desperately in need of py3 support for not just SNI, but many other things py2 doesn't support) start supporting python3 as soon as possible across the board.

python2 ssl support is rather horrible and shoehorning things like pyopenssl in doesn't really solve problems and creates a lot of code refactoring and dependencies.

i'll be very happy to test google facing modules for py3 support. google not supporting python3 pretty much across the board in all their tools, is pretty much the biggest reason i avoid using google tools.

any informed people that can explain why google strongly ignores py3? i'm not looking for rumor mongoring or hate bashing, i'm looking for avenues to address the problems.

p.s. i use sublimetext3 as well and i would dearly love to hook this up

@wldcordeiro

I really want to see this happen, is there a branch with Python 3 support in the works? I'm willing to help port the library. @craigcitro

@dgelvin
dgelvin commented Dec 11, 2014

+1 for Python 3 support.

@gnumdk
gnumdk commented Dec 18, 2014

Same here, will be happy to have python3 support and not deal with youtube by hand

@david30xie

please also update samples for Python3, as I've already got some issues using library under Python3

@hadim
hadim commented Dec 24, 2014

Since google/oauth2client#43 has been merged. I don't issue any issue to port gapc to py2/3 compatibility.

@johnthagen

+1

@cjerdonek

It would be good if the supported Python versions (i.e. non-support for Python 3) were properly documented (e.g. in the Trove classifiers in setup.py):

https://github.com/google/google-api-python-client/blob/master/setup.py#L87

This message is also misleading:

print('google-api-python-client requires python version >= 2.6.'

(from https://github.com/google/google-api-python-client/blob/master/setup.py#L25 )

@breezymri

+1 for python 3

@pferate
Contributor
pferate commented Jan 8, 2015

I've updated the codebase in my fork to work with both Python 2 and 3. It still can be optimized more, but it is passing all of the tests in 2.6, 2.7, 3.3, and 3.4.

Hopefully my pull request will be reviewed and merged soon, there are a lot of changes.

@Julienh
Julienh commented Jan 18, 2015

+1 for Python 3 support.

@iDevPy
iDevPy commented Jan 19, 2015

+1 for Python 3 support.

@Bobspadger

yep, really need python3 support now folks!

@tommyjcarpenter

This thread makes me cry. I am deeply saddened that the google-api-python-client is only available for Python2. This really throws a wrench in the works of my new project.

@chhantyal

It's really sad that there are so many requests, but no response from @google about roadmap.

@troygrosfield

Maybe twitter is a better way to reach them?

@cjerdonek

Is there any reason we can't consolidate around the most promising fork? Is there one?

@swans-one swans-one referenced this issue in ambitioninc/gclient-service-account-auth Jan 23, 2015
Merged

Update testing and interface #7

@llrs
llrs commented Feb 2, 2015

Anyone tried with the lib2to3? I am sure supported errors like these one are common:

  File "C:\Python33\lib\site-packages\googleapiclient\discovery.py", line 208
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

This line should be except ValueError as e: as lib2to3 automatically changes.

@methane
Contributor
methane commented Feb 2, 2015

@llrs See #25

@NotSqrt
NotSqrt commented Feb 2, 2015

๐Ÿ‘

@willmoy
willmoy commented Feb 7, 2015

Bit dumbfounded to find out I can't use Google APIs with Python 3 already, so adding my +1.

@hlwsmith
hlwsmith commented Feb 7, 2015

adding my +1 to this! Google does support py3.3+ in oauth2client, so why not here too?

@joyofdata

๐Ÿ‘

@RandomInsano

+1. I'll experiment with @pferate's fork for now.

@JelteF
JelteF commented Feb 15, 2015

I've been using that one quite successfully. However, I only use the calendar functionality. Be sure to use the version of oauthclient mentioned in that thread.

@dandesousa

+1

@jackgolding

+1

@fsufitch

+1

@gijoecool

+1

@sloria
sloria commented Feb 24, 2015

Big +1 to this.

@cnelson
cnelson commented Mar 4, 2015

+1

Hard to sell people on using good technologies like discovery documents when the tools aren't there to support them.

@meng-fu
meng-fu commented Mar 5, 2015

+1

@methane
Contributor
methane commented Mar 5, 2015

Please test #64 with your script instead of posting more +1.

@iDevPy
iDevPy commented Mar 5, 2015

@methan How i can do those tests?

@methane
Contributor
methane commented Mar 5, 2015
  1. Checkout #64 and install it.
  2. Run your program using google-api-python-client.
@cnelson
cnelson commented Mar 5, 2015

@methane I've been running my code under @pferate's fork for sometime now and it's working fine.

-Chris

@pferate
Contributor
pferate commented Mar 5, 2015

@cnelson I would recommend trying my python3-module_updates branch (the branch in #64). There should be no difference with my python3 branch operationally. I had to go and create a cleaner branch to get the code merged upstream. The branch in #64 will hopefully be merged soon.

@cnelson
cnelson commented Mar 5, 2015

@pferate I just updated my packages to build against https://github.com/pferate/google-api-python-client/zipball/python3-module_updates#egg=google-api-python-client-1.3.2 and it still looks good.

It'll be great to see this merged in, thanks for all the work!

@nathanielmanistaatgoogle
Contributor

As of cf939a3 we believe google-api-python-client fully supports Python 3. Please everyone try it out and let us know where and how we've created problems. :-)

@tommyjcarpenter

NATHANIELMANISTA +10000

@pferate
Contributor
pferate commented Mar 10, 2015

Feels good to finally have this taken care of.

Thanks for reviewing the code @nathanielmanistaatgoogle! Also thanks to everyone else who helped out with this, including @craigcitro and @methane!

@nathanielmanistaatgoogle
Contributor

@tommyjcarpenter: looks like that would be covered by either #44 or #61?

@methane, @pferate: looks like we missed a spot?

@pferate
Contributor
pferate commented Mar 10, 2015

@tommyjcarpenter: that error looks like it is from an older revision. Please note that this hasn't been pushed outside of github yet (to my knowledge), so you will have to install this package manually for now.

@JelteF
JelteF commented Mar 10, 2015

You can use the trick from this comment: #45 (comment)
Now that it's merged you can use this in your requirements.txt

git+git://github.com/google/google-api-python-client@master#egg=google-api-python-client

And remember to use oauth2client 1.4.2 instead of the newest one.

@cnelson
cnelson commented Mar 10, 2015

FWIW, this looks solid to me across python 2 and python 3. My test suite runs clean.

Any idea when we can expect to see this hit PyPI?

Tox output

py26: commands succeeded
py27: commands succeeded
py33: commands succeeded
py34: commands succeeded
flake8: commands succeeded
congratulations :)
@tommyjcarpenter

Ahh, sorry, my fault! I pip3ed (which worked) without realizing this probably wasn't pushed into PyPi yet.

@pferate
Contributor
pferate commented Mar 10, 2015

Not sure when it will be pushed. I created another PR (#67) to update some setup.py for PyPi, but it will be up to the Googlers to push it out.

@nathanielmanistaatgoogle
Contributor

Python 3 support has now been pushed to PyPI as version 1.4.0 (https://pypi.python.org/pypi/google-api-python-client/1.4.0). Please everyone test away and report defects and mistakes back to us here?

@Bartvds Bartvds referenced this issue in debrouwere/google-analytics Mar 11, 2015
Closed

Python 3 support? #9

@tommyjcarpenter

@methane It looks like that was not yet pushed to PyPI. Latest install 0.9 still broken. Installing from source worked!

@kylegoetz

"No Python 3 Support" probably should be up front and center. I spent quite a while trying to figure out why installing with pip3 worked but the Google samples all failed on authorization. It's because clean_headers() that the docs says converts bytes to strings actually converts strings to bytes with Python 3!

@wldcordeiro

@kylegoetz Read this thread, Python 3 is supported but the package on PyPI isn't updated yet.

@kylegoetz

@wldcordeiro Sorry, the issue is still marked as open, so I thought that meant the issue was not resolved.

In any case, this repo instructs you to install with pip, and installing with pip downloads a version for Python 2 even if you're using pip for Python 3. So the install instructions are not correct. That's all I was trying to say: should be corrected install instructions.

@tommyjcarpenter

Pip3 install from Google works now, if you install httplib2 from master from source first. That library is the one that hasn't yet been pushed to PyPi. I pip3ed the Google API without problems after installing that library.

(On my phone, sorry for any typos)

On Mar 21, 2015, at 19:21, kylegoetz notifications@github.com wrote:

@wldcordeiro Sorry, the issue is still marked as open, so I thought that meant the issue was not resolved.

In any case, this repo instructs you to install with pip, and installing with pip downloads a version for Python 2 even if you're using pip for Python 3. So the install instructions are not correct. That's all I was trying to say: should be corrected install instructions.

โ€”
Reply to this email directly or view it on GitHub.

@tmatsuo
Member
tmatsuo commented Apr 13, 2015

Good news!
httplib2 0.9.1 is released and now it's working even if you get everything from PyPi.

@tommyjcarpenter

๐ŸŽ‰๐Ÿ˜€๐Ÿ‘

@wldcordeiro

This issue can be closed at this point.

@cjerdonek

Please everyone test away and report defects and mistakes back to us here?

FYI, I'm having trouble sending e-mails with binary (PDF) attachments when using Python 3.4 (google-api-python-client version 1.4.0 and httplib2 version 0.9.1). Issue filed here.

@nathanielmanistaatgoogle
Contributor

This seems to be an overall success; closing this issue.

@xenomachina

This page still says only 2.6 and 2.7 are supported: https://developers.google.com/api-client-library/python/start/installation

@tmatsuo
Member
tmatsuo commented May 9, 2015

@xenomachina Thanks! Filed an internal bug.

@wescpy
Member
wescpy commented Aug 6, 2015

Bug fixed... the official docs now state 2.6, 2.7, 3.3, and 3.4 are supported. Python 3 users will probably use "pip3" instead of "pip".

@david30xie

Excellent!

----ย 
Best Regards,
David Xie
Founder of ScriptFan technology community -ย http://scriptfan.com
Manager of Xi'an GDG (Google Developer Group) - http://gdgxian.org
http://about.me/davidx


Everything happens for a reason. Attitude determines everything!

On 7 August, 2015 at 3:11:54 am, wesley chun (notifications@github.com) wrote:

Bug fixed... the official docs now state 2.6, 2.7, 3.3, and 3.4 are supported. Python 3 users will probably use "pip3" instead of "pip".

โ€”
Reply to this email directly or view it on GitHub.

@tokland tokland referenced this issue in tokland/youtube-upload Aug 10, 2015
Merged

Added Python3 support #53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment