Difference between revisions of "Python3"
(→OpenStack clients) |
(→Others) |
||
Line 118: | Line 118: | ||
|} | |} | ||
− | === | + | === Core OpenStack projects === |
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
|- | |- | ||
− | ! Project !! Python 3 compatibility !! CI tests running? !! Blocked by !! Comment | + | ! Project !! Python 3 compatibility !! CI tests running? !! Trove classifiers !! Blocked by !! Comment |
|- | |- | ||
− | | | + | |
+ | | [https://pypi.python.org/pypi/ceilometer ceilometer] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || | ||
+ | * eventlet | ||
+ | * hacking | ||
+ | * mysql-python | ||
+ | * oslo.config | ||
+ | * oslosphinx | ||
+ | * python-ceilometerclient | ||
+ | * python-glanceclient | ||
+ | * python-swiftclient | ||
+ | * sphinxcontrib-docbookrestapi | ||
+ | * sphinxcontrib-httpdomain | ||
+ | * sphinxcontrib-pecanwsme | ||
+ | * sqlalchemy-migrate | ||
+ | * swift | ||
+ | * thrift (which is blocking happybase) | ||
+ | || | ||
+ | |- | ||
+ | |||
+ | |||
+ | | [https://pypi.python.org/pypi/cinder cinder] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || | ||
+ | * ecdsa (which is blocking paramiko) | ||
+ | * eventlet | ||
+ | * hacking | ||
+ | * mysql-python | ||
+ | * oslo.config | ||
+ | * oslo.rootwrap | ||
+ | * oslo.sphinx | ||
+ | * paste | ||
+ | * python-glanceclient | ||
+ | * python-swiftclient | ||
+ | * rtslib-fb | ||
+ | * sqlalchemy-migrate | ||
+ | * suds | ||
+ | * taskflow | ||
+ | || | ||
+ | |- | ||
+ | |||
+ | |||
+ | | [https://pypi.python.org/pypi/glance glance] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || | ||
+ | * boto | ||
+ | * eventlet | ||
+ | * hacking | ||
+ | * mysql-python | ||
+ | * oslo.config | ||
+ | * oslo.messaging | ||
+ | * oslosphinx | ||
+ | * paste | ||
+ | * python-cinderclient | ||
+ | * python-swiftclient | ||
+ | * qpid-python | ||
+ | * sqlalchemy-migrate | ||
+ | || | ||
|- | |- | ||
− | | | + | |
− | * eventlet | + | | [https://pypi.python.org/pypi/heat heat] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || |
− | * python-neutronclient | + | * ecdsa (which is blocking paramiko) |
+ | * eventlet | ||
+ | * hacking | ||
+ | * oslo.config | ||
+ | * oslo.sphinx | ||
+ | * python-ceilometerclient | ||
+ | * python-cinderclient | ||
+ | * python-glanceclient | ||
+ | * python-heatclient | ||
+ | * python-neutronclient | ||
+ | * python-swiftclient | ||
+ | * python-troveclient | ||
+ | * qpid-python | ||
+ | * sqlalchemy-migrate | ||
+ | || | ||
|- | |- | ||
− | | | + | |
− | * | + | | [https://pypi.python.org/pypi/horizon horizon] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || |
− | * | + | * django-compressor |
− | * | + | * django-openstack-auth |
− | * | + | * eventlet |
− | * | + | * hacking |
+ | * nose-exclude | ||
+ | * nosehtmloutput | ||
+ | * nosexcover | ||
+ | * openstack.nose-plugin | ||
+ | * oslo.sphinx | ||
+ | * python-ceilometerclient | ||
+ | * python-cinderclient | ||
+ | * python-glanceclient | ||
+ | * python-heatclient | ||
+ | * python-neutronclient | ||
+ | * python-swiftclient | ||
+ | * python-troveclient | ||
|| | || | ||
|- | |- | ||
− | | | + | |
+ | |||
+ | |||
+ | | [https://pypi.python.org/pypi/keystone keystone] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || | ||
+ | * eventlet | ||
+ | * hacking | ||
+ | * oslo.config | ||
+ | * oslo.messaging | ||
+ | * oslosphinx | ||
+ | * pam | ||
+ | * paste | ||
+ | * pycadf | ||
+ | * python-ldap | ||
+ | * sqlalchemy-migrate | ||
+ | || | ||
|- | |- | ||
− | | | + | |
− | | | + | |
− | * eventlet | + | | [https://pypi.python.org/pypi/neutron neutron] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || |
− | * | + | * eventlet |
− | * | + | * hacking |
− | * | + | * jsonrpclib |
− | * | + | * oslo.config |
− | * | + | * oslo.rootwrap |
− | || | + | * paste |
+ | * python-neutronclient | ||
+ | || | ||
|- | |- | ||
− | | | + | |
+ | |||
+ | | [https://pypi.python.org/pypi/nova nova] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || | ||
+ | * boto | ||
+ | * ecdsa (which is blocking paramiko) | ||
+ | * eventlet | ||
+ | * hacking | ||
+ | * mysql-python | ||
+ | * oslo.config | ||
+ | * oslo.messaging | ||
+ | * oslo.rootwrap | ||
+ | * oslosphinx | ||
+ | * paste | ||
+ | * pycadf | ||
+ | * python-cinderclient | ||
+ | * python-glanceclient | ||
+ | * python-neutronclient | ||
+ | * sqlalchemy-migrate | ||
+ | * suds | ||
+ | * websockify | ||
+ | || | ||
|- | |- | ||
− | | | + | |
− | |} | + | | [https://pypi.python.org/pypi/swift swift] || style="background-color:red;" | No || style="background-color: red;" | No || style="background-color: red;" | No || |
+ | * dnspython | ||
+ | * eventlet | ||
+ | * hacking | ||
+ | * netifaces | ||
+ | * nosehtmloutput | ||
+ | * nosexcover | ||
+ | * openstack.nose-plugin | ||
+ | * python-swiftclient | ||
+ | || | ||
+ | |-} | ||
== Reports at OpenStack Summits == | == Reports at OpenStack Summits == |
Revision as of 16:13, 28 February 2014
This page tracks the progress of Python 3 effort porting for OpenStack.
Contents
Python 3
Why should OpenStack move to Python 3 right now?
- Python 3 is usually seen as the new Python version which breaks compatibility and raises new Unicode issues. Python 3 is much more than that. It’s a new clean language which has a more consistent syntax. It has many new features, not less than 15 new modules. Python 3 is already well supported by major Linux distributions, whereas Python 2.7 reached its end-of-life. Slowly, some bugs cannot be fixed in Python 2.7 anymore and are only fixed in the latest Python 3 release. Python 3 is now 5 years old and considered as a mature programming language.
Port Python 2 code to Python 3
OpenStack project chose to use the same code base for Python 2 and Python 3. The Six: Python 2 and 3 Compatibility Library helps to write code working on both versions.
References to port Python 2 code to Python 3
- Porting to Python 3 Book by Lennart Regebro, especially the Language differences and workarounds.
- HOWTO: Porting Python 2 Code to Python 3 by Brett Cannon
- Porting Python Code to 3.x
- python-incompatibility: Demonstrates incompatibilities between Python versions.
Common pitfalls
What is a string ?
You should definitely not talk about "strings" in your commit logs/reviews. In Python 2, a 'string' is bytes; in Python 3, it's a Unicode text string. The following code snippet may help in understanding the difference:
Python 2:
>>> type('foo') <type 'str'> >>> type(u'foo') <type 'unicode'> >>> type(b'foo') <type 'str'> >>> isinstance('foo', six.text_type) False >>> isinstance(u'foo', six.text_type) True >>> bytes is str True >>> b'foo'[0] 'f'
Python 3:
>>> type('foo') <class 'str'> >>> type(u'foo') <class 'str'> >>> type(b'foo') <class 'bytes'> >>> isinstance('foo', six.text_type) True >>> isinstance(b'foo', six.text_type) False >>> bytes is str False >>> b'foo'[0] 102
Python 3 of OpenStack Dependencies
Blocker Pointer: it's not yet possible to specify different list of dependencies for Python 2 and Python 3. For example, mox only works on Python 2, mox3 can be used on Python 3.
- Julien Danjou proposed to add requirements-py3.txt: openstack/requirements patch and openstack-dev/pbr patch
- An alternative is to support markers in requirements (in pip): pip issue: Support markers in setup(install_requires)?; Victor Stinner's pull request: "parse requirements in markers"
OpenStack Dependencies:
- mox: use mox3 or port tests on mock which works on Python 3 (mock has been integrated in Python 3.3 as unittest.mock)
- eventlet: not available on Python 3 yet, alternatives: asyncio (Tulip for Python 3.3+/Trollius for Python 2), Tornado
Portage in progress
- Oslo Messaging: Portage in Progress by Victor Stinner (dashboard)
- glanceclient: Portage in Progress by Cyril Roelandt (dashboard)
- heatclient: Portage in Progress by Cyril Roelandt (dashboard)
- neutronclient: Portage in Progress by Cyril Roelandt (dashboard)
- glanceclient: Portage in Progress by Cyril Roelandt (dashboard)
Portage done
- keystoneclient: Portage in Progress by Cyril Roelandt (dashboard)
Python 3 Status of OpenStack projects
See also Python3Deps.
OpenStack clients
Core OpenStack projects
Project | Python 3 compatibility | CI tests running? | Trove classifiers | Blocked by | Comment |
---|---|---|---|---|---|
ceilometer | No | No | No |
|
|
cinder | No | No | No |
|
|
glance | No | No | No |
|
|
heat | No | No | No |
|
|
horizon | No | No | No |
|
|
keystone | No | No | No |
|
|
neutron | No | No | No |
|
|
nova | No | No | No |
|
|
swift | No | No | No |
|