Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Python 3.x Support #35

Open
jsherer opened this issue Apr 22, 2013 · 10 comments
Open

Python 3.x Support #35

jsherer opened this issue Apr 22, 2013 · 10 comments

Comments

@jsherer
Copy link

jsherer commented Apr 22, 2013

Python 3 was released in 2008 and has since become a very stable platform. Gearman needs to have a Python 3 supported library.

@toudi
Copy link

toudi commented Sep 5, 2014

hi.

i would be willing to help in adding support for python 3.

any hints on how should this be achieved?

i looked at the code today. There were several exceptions which are catched this way:

except foo, bar

instead of

except foo as bar

unfortunetely the pypi page for gearman states that it has support for python 2.4, so i don't think that we can easily rewrite this.

another thing seems to be also in connection.py - there is array.array('c') which is no longer supported, and array.array('u') is concidered deprecated and will soon be removed.

i tried changing it to array.array('b'), but then the decoding procedure fails somewhere in the middle, i still haven't figured this out yet.

last but not least, the connection manager uses asyncore / select calls. Would it be possible to use asyncio from python 3.4 ? or would we want to continue supporting python 3.0 which lacks it?

overall, what would be the target refactoring - have multiple python modules and attach them in setup.py based on python version?

like..

if python_version >= 3.4:
( append asyncio support )

elif python _version <= 2.7:
append current packages

best regards

@svisser
Copy link

svisser commented Sep 7, 2014

I would be interested in this as well.

I think we should consider dropping support 2.4 and 2.5 given that 2.6+ is more common nowadays. The latest Python release is Python 3.4 and it's more feasible to have a 2.6, 2.7 and 3.x+ compatible codebase as opposed to also supporting 2.4 and 2.5 (which are about a decade old now).

@svisser
Copy link

svisser commented Sep 8, 2014

I have made a pull request here to make all non-risky changes towards making the codebase suitable for Python 2.x and Python 3.x: #63. The next step would be to ensure bytes and Unicode separation is done properly, both in the code and in the tests.

@toudi
Copy link

toudi commented Sep 19, 2014

oh, i have just seen it. great work!

i think that i'd need to do a fork of your branch so that we could work there and eventually add support for python 3 ;)

@svisser
Copy link

svisser commented Sep 19, 2014

Yes, feel free to fork and make pull requests. We can then add full 3.x support, rename the issue and hopefully merge it in.

@mitaka
Copy link

mitaka commented Oct 30, 2014

+1 for python3 support. I have tried paching some code but it still fails with encoding/decoding the binary data.

@svisser
Copy link

svisser commented Oct 30, 2014

@mitaka yes, I'm aware. Haven't worked on it recently. The issue is also that there isn't full code coverage for all parts and in those parts it's currently breaking in Python 3.x.

@msjaiswal
Copy link

We recently translated this client to python3. Give it a shot. Everything except administrative tasks should be fine. https://github.com/msjaiswal/python3-gearman

@jsherer
Copy link
Author

jsherer commented Dec 14, 2015

Thanks for the heads up @msjaiswal. Did you not implement administrative tasks? Or is there another reason why they wouldn't work?

@msjaiswal
Copy link

Did not implement them yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants