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

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.

craigcitro avatar May 19 '14 22:05 craigcitro

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:
      • https://github.com/jcgregorio/httplib2
    • this is probably the safest approach if backwards compatibility is the number 1 concern
  2. combined code base that supports both python2 and python3
    • here is a good implementation and the framework I am using in Python3
      • https://github.com/Pylons/pyramid

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.

ianjosephwilson avatar Jun 02 '14 20:06 ianjosephwilson

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

craigcitro avatar Jun 02 '14 23:06 craigcitro

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

ianjosephwilson avatar Jun 03 '14 00:06 ianjosephwilson

2.6 is fine for a minimum version.

craigcitro avatar Jun 03 '14 01:06 craigcitro

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

ianjosephwilson avatar Jun 03 '14 04:06 ianjosephwilson

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

JelteF avatar Jun 08 '14 16:06 JelteF

+1

esistgut avatar Jul 12 '14 11:07 esistgut

wait.. google doesn't support python3?

dustinfarris avatar Aug 14 '14 21:08 dustinfarris

Yeah, it's ridiculous On Aug 14, 2014 11:10 PM, "Dustin Farris" [email protected] wrote:

wait.. google doesn't support python3?

— Reply to this email directly or view it on GitHub https://github.com/google/google-api-python-client/issues/3#issuecomment-52245125 .

JelteF avatar Aug 14 '14 21:08 JelteF

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

slessans avatar Aug 14 '14 21:08 slessans

dammit, google :-1:

dustinfarris avatar Aug 14 '14 21:08 dustinfarris

Hah! From the Python example in their docs:

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

Not!

dustinfarris avatar Aug 14 '14 23:08 dustinfarris

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.

craigcitro avatar Aug 15 '14 16:08 craigcitro

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

fake-name avatar Sep 25 '14 08:09 fake-name

+1

hyunwooj avatar Oct 09 '14 22:10 hyunwooj

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

troygrosfield avatar Nov 07 '14 18:11 troygrosfield

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

craigcitro avatar Nov 07 '14 18:11 craigcitro

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

icoxfog417 avatar Nov 11 '14 05:11 icoxfog417

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.

Alex3917 avatar Nov 29 '14 23:11 Alex3917