[openstack-dev] [nova] Port Nova to Python 3
stoner at redhat.com
Fri Apr 24 20:07:43 UTC 2015
On Friday, April 24, 2015 09:13:14 AM Victor Stinner wrote:
> > If written to use python 3, I hope it will use all the new features
> > of python 3.4 moving forward.
> The spec adds Python 3 support, but it keeps Python 2 support. It's
> too early to drop Python 2, Nova is deployed everywhere with Python
> > For example, argument annotations, coroutines, asyncio, etc.
> Argument annotations are not used in practice :-( There is a PEP under
> review which targets the future Python 3.5 version:
Yeah, that is a shame. I know many who are vehemently against argument
annotations or type hinting, but i think it has its usefulness.
> I'm working actively on asyncio. I wrote a spec to replace eventlet
> with asyncio:
> superseded by: https://review.openstack.org/#/c/164035/
> For OpenStack, I ported asyncio to Python 2: it's the Trollius
> I would also prefer to be able to use new shiny Python 3 features, but
> it's not possible yet. We have to move step by step. There is no
> choice like "Python 2 only" or "Python 3 only with new Python 3
> features". Changes must be done incrementally in OpenStack. We all
> know that.
I understand. I hope this is a stepping stone to python 3 only :)
> > At my last workplace, we tried to make our project python2 and 3
> > compatible (ie, you could run it under 2.7 or 3.3+) but this was
> > the worst of all worlds.
> Does it mean that you are against the whole spec?
> I don't know any Python project in the wild which was really ported to
> Python 3: drop Python 2 support at the same time. Supporting only
> Python 3 only slowly becomes a good choice for *new* projects.
This was a proprietary project at another company, so it wasn't open
I'm not against the spec as it is. If nothing else, it paves the way to
eventually use the nice python 3+ only features :)
What I meant by the worst of both worlds is that you don't get the nice
new features of python3, while simultaneously dealing with the headaches
of making code run under both python versions. You'll have to do weird
things with imports (for example urllib) and deal with the
inconsistencies between some functions that return strings and some that
return unicode, and some that return bytes.
It's not impossible, but you have to add that extra work while also
depriving yourself of the goodness of python3 only features :)
> All projects are ported by adding Python 3 support in addition to
> Python 2 support. The six module is a great module to limit changes
> on the source code.
> See my early draft patch to port nova to Python 3:
> Joe Goron wrote "I like how the sha1 starts with 'bad'. Overall that
> is a pretty small patch." ;-)
> ____ OpenStack Development Mailing List (not for usage questions)
> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
More information about the OpenStack-dev