googleapis / google-api-python-client

🐍 The official Python client library for Google's discovery based APIs.
https://googleapis.github.io/google-api-python-client/docs/
Apache License 2.0
7.74k stars 2.41k forks source link

Python 3 #3

Closed rozling closed 9 years ago

rozling commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

@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 commented 10 years ago

@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 commented 10 years ago

2.6 is fine for a minimum version.

ianjosephwilson commented 10 years ago

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 commented 10 years ago

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

esistgut commented 10 years ago

+1

dustinfarris commented 10 years ago

wait.. google doesn't support python3?

JelteF commented 10 years ago

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 https://github.com/google/google-api-python-client/issues/3#issuecomment-52245125 .

slessans commented 10 years ago

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

dustinfarris commented 10 years ago

dammit, google :-1:

dustinfarris commented 10 years ago

Hah! From the Python example in their docs:

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

Not!

craigcitro commented 10 years ago

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.

fake-name commented 10 years ago

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

hyunwooj commented 10 years ago

+1

troygrosfield commented 9 years ago

@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 commented 9 years ago

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

icoxfog417 commented 9 years ago

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

Alex3917 commented 9 years ago

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 commented 9 years ago

+1 for Python 3 support.

javiergarciad commented 9 years ago

+1 for Python 3 support.

leto commented 9 years ago

:+1: for python support. I want to start a new project and this is the only dependency that requires Python 2

victorhooi commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

+1 for Python 3 support.

ghost commented 9 years ago

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

darth30joker commented 9 years ago

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

hadim commented 9 years ago

Since https://github.com/google/oauth2client/pull/43 has been merged. I don't issue any issue to port gapc to py2/3 compatibility.

johnthagen commented 9 years ago

+1

cjerdonek commented 9 years ago

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 commented 9 years ago

+1 for python 3

pferate commented 9 years ago

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 commented 9 years ago

+1 for Python 3 support.

iDevPy commented 9 years ago

+1 for Python 3 support.

Bobspadger commented 9 years ago

yep, really need python3 support now folks!

tommyjcarpenter commented 9 years ago

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 commented 9 years ago

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

troygrosfield commented 9 years ago

Maybe twitter is a better way to reach them?

cjerdonek commented 9 years ago

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

llrs commented 9 years ago

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 commented 9 years ago

@llrs See https://github.com/google/google-api-python-client/pull/25

NotSqrt commented 9 years ago

:+1:

willmoy commented 9 years ago

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

ghost commented 9 years ago

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

joyofdata commented 9 years ago

:+1:

RandomInsano commented 9 years ago

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

JelteF commented 9 years ago

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 commented 9 years ago

+1