Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3 #171

Closed
posita opened this issue Sep 17, 2015 · 39 comments
Closed

Support Python 3 #171

posita opened this issue Sep 17, 2015 · 39 comments

Comments

@posita
Copy link

posita commented Sep 17, 2015

An increasing number of third party libraries are becoming python3-only. It would be nice if Cyclone could run in Python 3.

@dpnova
Copy link
Collaborator

dpnova commented Sep 17, 2015

python3 only?

Cyclone is based on twisted, twisted is not completely python3 compatible yet, so the urgency doesn't really exist yet.

I'm open to supporting python 3 though..

@posita
Copy link
Author

posita commented Sep 17, 2015

Sorry...I didn't mean to confuse anyone. Some other libraries are python3-only. Cyclone is python2-only. Ne'er the twain shall meet until Cyclone can run in Python 3. I wasn't suggesting that Cyclone give up its ability to function in Python 2. (I.E., it would be nice if it supported both.)

@posita posita changed the title Python3 support Python 3 support Sep 17, 2015
@posita posita changed the title Python 3 support Support Python 3 (in addition to Python 2) Sep 17, 2015
@evilaliv3
Copy link

Starting from Ubuntu 16.04 (LTS) [21th April 2016] ubuntu will include by default support for only python 3, so this is becoming a fundamental requirement: http://summit.ubuntu.com/uos-1511/meeting/22568/python3-only-on-the-images/

i've done a small analysis of what is needed for making cyclone work on python3 and here follows various fixes; most of them are taken from the upstream code of tornado.
i've currently fixed the errors triggered by the unit tests and managed to work half of the tests: evilaliv3@3c6525b
@dpnova if you are interested in working i will try to support you as much that i can.

references:
http://python3porting.com/noconv.html
http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html

\cc @fpietrosanti

@dpnova
Copy link
Collaborator

dpnova commented Jan 7, 2016

I've not moved to py3 yet @evilaliv3 - but I think this is work worth doing. Could you put together some short notes on the approach to take here? Maybe we can both work out of a single feature branch in one of our forks to get this moving?

Cheers

@evilaliv3
Copy link

evilaliv3 commented Jan 7, 2016

There is not an automagic approach here but it's not that difficul.

What i would do is to identify the main issues in the code running some ide inspection (i use pycharm an i can do it wi it) or simpyl with pylint and recognize the main syntax errors in reference to python3; then try to make all the unit tests working.

From what i've seen right now (you can see some fixes here: evilaliv3@3c6525b) there are two kind of errors only:

  • variables that changed names / or have been packaged differently in python3; for all there is an if else to write, and we find all already done in the upstream tornado repository.
  • "execpt Exception, e" is a stupid syntax removed in python3 that has to be written "except Exception as e"

reviewing my patch and making the unit tests work will give use more than a 90% of python3ness!

@posita
Copy link
Author

posita commented Jan 7, 2016

One thing I would recommend (which is somewhat antithetical to the accepted practices) is to start using Unicode everywhere (including in Python 2). Part (but not all) of this is from __future__ import unicode_literals. Keep in mind the default behavior results in identical syntax can have wildly different semantics depending on what the execution environment is (which can lead to all kinds of headaches). If you're already committed to abandoning support for 2.6, this gets a lot easier. A lot of the Unicode-savvy functionality has been back-ported to 2.7 (see, e.g., io).

That's just my $1.05 (NSFW).

@posita posita mentioned this issue Jan 11, 2016
@ygl-rg
Copy link

ygl-rg commented Mar 3, 2016

twisted for py3 is almost completed. So I think it is a good time to consider porting cyclone to py3.

I did some trials last year. Porting to py3 takes effort but not that difficult. (Well, at least it is easier than porting twisted to py3).

@auvipy
Copy link

auvipy commented Jun 26, 2016

If python 2.7 and python 3.4 and 3.5 is targeted withh latest tornado and twisted versions then the work should be much easier to start.

@evilaliv3
Copy link

@dpnova do you have any update on this side?

@dpnova
Copy link
Collaborator

dpnova commented Jan 11, 2017

I'm finishing my current job soon, so I'll be dedicating some serious time to this and other OSS things I need to get sorted. About a month from now!

@fiorix
Copy link
Owner

fiorix commented Jan 12, 2017

👍

@ygl-rg
Copy link

ygl-rg commented Mar 2, 2018

Hi All

I forked the cyclone and made it work with python 3. The link is here:

https://github.com/ygl-rg/cyclone3

Note: it is for python 3.5 or later version only, so it is incompatible with python 2.x.

Hope it can help

Regards

gelin yan

@fiorix
Copy link
Owner

fiorix commented Mar 14, 2018

Good stuff.

@waghanza
Copy link

waghanza commented Sep 5, 2018

thanks @ygl-rg for porting cyclone into python3

@fiorix will this work be integrated / implemented in cyclone ?

we have trying to integrate cyclone in our benchmarking tool

@fiorix
Copy link
Owner

fiorix commented Sep 5, 2018

I'm totally fine with merging it. Send a PR :)

@fiorix
Copy link
Owner

fiorix commented Sep 5, 2018

Just merged #173 :)

@waghanza
Copy link

waghanza commented Sep 7, 2018

Can we close ?

@fiorix
Copy link
Owner

fiorix commented Sep 7, 2018

👍

@fiorix fiorix closed this as completed Sep 7, 2018
@mudivili
Copy link

Is this released yet? I am getting an error on python 3 in cyclone 1.2

builtins.TypeError: a bytes-like object is required, not 'str'

Any idea?

@fiorix
Copy link
Owner

fiorix commented Nov 30, 2018

I thought so. Now looking at the .travis.yml I see it only tests in py 2.7. Is there a bug in setup.py?

@fiorix fiorix reopened this Nov 30, 2018
@waghanza
Copy link

@mudivili python3 is not fully compatible, I have the same for https://github.com/the-benchmarker/web-frameworks/blob/master/python/cyclone/server.py so we use https://github.com/ygl-rg/cyclone3.git

@fiorix do not have the time to fix this, but I'll be glad to see full python3 support

@waghanza
Copy link

@fiorix also, there is still the question : can we drop python2.7 support ?

@ygl-rg
Copy link

ygl-rg commented Nov 30, 2018

@mudivili python3 is not fully compatible, I have the same for https://github.com/the-benchmarker/web-frameworks/blob/master/python/cyclone/server.py so we use https://github.com/ygl-rg/cyclone3.git

@fiorix do not have the time to fix this, but I'll be glad to see full python3 support

When I planned to port cyclone to python 3.x, I found out make it work for both python 2.x and 3.x would take more effort.

I decided to make a python 3.x only version finally due to limited schedule, so It implies merging to the main stream is not so easy if it is not impossible.

@waghanza
Copy link

And also python2 end of life is coming ...

@fiorix
Copy link
Owner

fiorix commented Dec 13, 2018

I don't mind dropping support for python2 at all.

@waghanza
Copy link

Awesome, I can then work on it (I hope I'll have the time to do do)

@waghanza
Copy link

@ygl-rg I'll merge your fork to drop python2 support. Thanks for your work

@waghanza
Copy link

@fiorix I've started #186 to drop python2 support

Actually, this work for my implementation https://github.com/waghanza/http-benchmark/blob/master/python/cyclone/server.py

@waghanza
Copy link

@posita @dpnova Could we change the issue title ? As twisted has full python3 (even 3.7) support it's time to be on the road again 😛

@posita
Copy link
Author

posita commented Dec 29, 2018

No objection from me.

@posita posita changed the title Support Python 3 (in addition to Python 2) Support Python 3 Dec 29, 2018
@waghanza
Copy link

waghanza commented Jan 3, 2019

I've started a to add python3 support, here is a list of tasks to do :

@rajeev2912
Copy link

Hi @waghanza - I am migrating my cyclone based service to python3. I am blocked as cyclone 1.2 version is incompatible with python3.

Do you have any forecast for supporting cyclone on python3? If it's going to be a bit late in year, do you have any suggestion for workaround?

Thank you in advance for working on this migration.

@waghanza
Copy link

waghanza commented May 1, 2019

Ηi @rajeev2912,

Unfortunately, I can't finish the first PR supporting python3 (#186) soon.

Even if the CI passes, somes features are broken (requires works). I can not fix them until mid-august.

Regards,

@waghanza
Copy link

waghanza commented Jul 1, 2019

@rajeev2912 PR #186 is ready, waiting to be merged, probably by @fiorix

@waghanza
Copy link

Thanks all, this has been merged and released

@waghanza
Copy link

@forix @dpnova can we close ?

@fiorix
Copy link
Owner

fiorix commented Sep 19, 2019

Yes, awesome job, thanks all !

This is closing a 4 year chapter :) Time to celebrate.

@fiorix fiorix closed this as completed Sep 19, 2019
@waghanza
Copy link

@fiorix Do you consent that I add cyclone in #186 ?

@fiorix
Copy link
Owner

fiorix commented Oct 3, 2019

@fiorix Do you consent that I add cyclone in #186 ?

Yes, definitely.

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

No branches or pull requests

8 participants