google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

Python 3

Open rozling opened this issue 12 years ago • 87 comments

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.

rozling avatar May 06 '14 13:05 rozling

@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.

pferate avatar Mar 05 '15 15:03 pferate

@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!

cnelson avatar Mar 05 '15 16:03 cnelson

As of cf939a33f6b8 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. :-)

NATHANIELMANISTA +10000

tommyjcarpenter avatar Mar 10 '15 17:03 tommyjcarpenter

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!

pferate avatar Mar 10 '15 19:03 pferate

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

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

@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.

pferate avatar Mar 10 '15 19:03 pferate

You can use the trick from this comment: https://github.com/google/google-api-python-client/pull/45#issuecomment-70196973 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.

JelteF avatar Mar 10 '15 19:03 JelteF

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 :)

cnelson avatar Mar 10 '15 20:03 cnelson

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

tommyjcarpenter avatar Mar 10 '15 20:03 tommyjcarpenter

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.

pferate avatar Mar 10 '15 20:03 pferate

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?

@tommyjcarpenter See jcgregorio/httplib2#296

methane avatar Mar 11 '15 03:03 methane

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

tommyjcarpenter avatar Mar 11 '15 12:03 tommyjcarpenter

"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!

kylegoetz avatar Mar 21 '15 06:03 kylegoetz

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

wldcordeiro avatar Mar 21 '15 23:03 wldcordeiro

@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.

kylegoetz avatar Mar 21 '15 23:03 kylegoetz

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 [email protected] 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.

tommyjcarpenter avatar Mar 21 '15 23:03 tommyjcarpenter

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

tmatsuo avatar Apr 13 '15 17:04 tmatsuo

🎉😀👍

tommyjcarpenter avatar Apr 13 '15 17:04 tommyjcarpenter