Re:Uvloop: Fast Python networking
by jamesmishra on Wednesday May 04, 2016 @12:21AM
(#11626163)
It looks like uvloop requires Python 3.5. How practical is it to create a fork for companies stuck on Python 2.7?
[ Parent
| on HN ]
Not really practical. uvloop is designed to work in tandem with asyncio, which is a Python 3-only module. asyncio, in turn, requires 'yield from' support, something that Python 2 doesn't have.
The 'Trollius' module backported asyncio to Python 2, requiring syntax changes, though. For example "yield from" to "yield From()".
Work on Trollius was stopped a few weeks ago, there wasn't enough interest/use. Call for interested maintainers, http://trollius.readthedocs.io/deprecated.html#deprecated
The problem with Trollius was that packages that asyncio packages needed explicitly to add support for it to work (because Python 2 does not have yield from) Several packages (I remember aiohttp was one of them) did not want to do that.
> How practical is it to create a fork for companies stuck on Python 2.7?
Not very, it's an alternative event loop for asyncio[0] which was introduced in 3.4 and builds upon other Python 3 features (e.g. `yield from`)
Use either docker or/and crossbar.io to isolate the 2.7 code as a service if you don't want to port it, then add the rest of the code in 3.
Re:Uvloop: Fast Python networking
by sharpshadow on Wednesday May 04, 2016 @03:05AM
(#11626703)
Today it should be good practice to use containers with Python 2.7 and 3.5 or any other versions you like.
With that you can solve most szenarios.
Python is actually designed in such way that you can install multiple major versions and they can coexist perfectly fine together.
For example you can install python 2.6, 2.7, 3.3, 3.4, & 3.5 all on one host without any conflicts. The limitation is that many distributions prefer to not maintain different versions of supposedly the same language.
If you use RedHat or CentOS you can just use https://ius.io/ and get access to the other python versions. This is one of few repos that makes sure the packages don't conflict with system ones.