Add Python 3 support to Solum

Registered by Victor Stinner on 2015-09-24

It’s time to add Python 3 support to Solum by generalizing the usage of the six module, in addition to the Python 2 support.

The goal is to make Solum compatible with Python 3 at the end of the Liberty cycle.

For the rationale, the plan and work items, please see Nova Python 3 spec, since it's almost the same for Solum:
http://specs.openstack.org/openstack/nova-specs/specs/liberty/approved/adding-python34-support-to-nova.html

Summary of the plan:

* Write a few bunch of patches to fix the most obvious Python 3 syntax issues (dict.iteritems, 123L, reraise an exception, etc.) to be able to load unit tests
* Find a subset of unit tests which pass on Python 3.4 and add a py34 target in tox.ini to run them.
* Add a non-voting py34 check job running tox -e py34
* When the py34 check job becomes stable enough, make it voting. At this point, it's no more possible to add regressions on the Python 3 in the tests executed by tox -e py34
* Fix remaining tests one by one, each time add it to the py34 target of tox.ini

For more information on Python 3, see the wiki page: https://wiki.openstack.org/wiki/Python3

Blueprint information

Status:
Not started
Approver:
Devdatta Kulkarni
Priority:
Medium
Drafter:
Victor Stinner
Direction:
Approved
Assignee:
Victor Stinner
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
milestone icon next-mitaka

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/solum-python3,n,z

Addressed by: https://review.openstack.org/227393
    py3: Replace unicode with six.text_type

Addressed by: https://review.openstack.org/227396
    py3: Get httplib and __builtin__ from six.moves

Addressed by: https://review.openstack.org/227398
    py3: Get urllib and urlparse from six.moves

Addressed by: https://review.openstack.org/227403
    py3: Replace dict.iteritems() with dict.items()

Addressed by: https://review.openstack.org/227409
    py3: Replace types.BooleanType with bool

Addressed by: https://review.openstack.org/227410
    Replace string.letters with string.ascii_letters

Addressed by: https://review.openstack.org/227726
    py3: MultiType.validate() now catchs TypeError

Addressed by: https://review.openstack.org/227754
    py3: Stop using StandardError exception

Addressed by: https://review.openstack.org/227756
    Use @six.python_2_unicode_compatible decorator

Addressed by: https://review.openstack.org/227757
    py3: Replace exc.message with str(exc)

Addressed by: https://review.openstack.org/336404
    py3: Fix using map() for python2,3 compatibility

Addressed by: https://review.openstack.org/336411
    py3: Fix using filter() for python2,3 compatibility

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.