mike820324 / microProxy

A http/https interceptor written in pure python.
MIT License
17 stars 3 forks source link

[Discussion]: Moving to python 3.5 #215

Open mike820324 opened 7 years ago

mike820324 commented 7 years ago

It's an open discussion since I personally does not have any clue yet.

Python 3 has been more mature, and most linux distribution has python 3 available. I think we can consider start to support python 3.5. There are some advantages that we changed into python 3.5 or above.

Pros:

Here are some advantages that I think we can have when moving to python 3.

Python 2.7 end of life:

python 2.7 will be end of line after 3 years. https://pythonclock.org/

More io loop implementation choices:

Since python 3.4, the asyncio module has become the builtin modules and python 3.5 also introduce the async/await syntax. If we move to python 3.5 and above, there would be more choices of event loop implementations.

Some backport module no longer necessary:

Some of the modules that we depend on are already the builtin module in python 3.5. As a result, we can remove some redundant dependencies.

Type hint support:

Python 3.5 introduce the type hint (https://www.python.org/dev/peps/pep-0484/) and in Python 3.6 variable annotation will be introduced (https://www.python.org/dev/peps/pep-0526/). We can utilize this part and make our code more readable and maintainable.

Currently, mypy can help checking the type hint part.

Cons:

Moving to python 3.x support may also introduce some advantages,

Possible regression:

May have regressions especially the bytes, string and unicode part. Luckily, due to @chhsiao90 great work on unittest, I think these kind of regression can be easily found and fixed.

Code migration:

There will be huge amount of code modification in order to compatible with python 3.

As mentioned in the very begining of the title, I still have no clue whether or not to move to python 3. :)

chhsiao90 commented 7 years ago

The first question is what we want to support

My idea is that we could release a stable version that support 2.7 and 3.X After that, drop 2.7 support!

mike820324 commented 7 years ago

I totally agree with you.

The first public release would probably 0.5.0. And after 0.5.0, we will drop 2.7 support.

mike820324 commented 7 years ago

I'll create a github project to trackdown these python 3.x issues.

mike820324 commented 7 years ago

Adding a project card to track down python 3.x related issue. https://github.com/mike820324/microProxy/projects/1