On Thu, Apr 16, 2015 at 9:54 AM, Ken Giusti <kgiu...@redhat.com> wrote:

> Hi all,
> I'm building on the work done by Dominic and Mickael to get all the proton
> python bits to work under both python2 and python3.   See [1].
> I think this will entail a lot of little changes to the python sources and
> the unit tests.  Rather than check in a single huge patch, I'm going to
> break it up over several patches.
> The first bunch of patches will simply 'modernize' the existing python
> code.  Old style syntax that is not forward compatible with python 3 will
> be replaced (eg. print "foo" --> print("foo"), etc).  I'll use a tool
> called 'futurize' which is part of the python future toolset [2], [3].
> Once all python code is updated, then I'll begin introducing python 3
> specific patches, including the work already done by Dominic and Mickael.
> Of course I'll verify that none of these changes will break python 2.
>  I've got a local CI system that can build/test in both environments.
> From a discussion with Dominic, we agreed that it would be A Good Thing to
> use one of the existing Py2 <--> Py3 abstraction libraries.  These
> libraries provide utilities for writing code that works under both python
> versions.  I've used 'six' in the past [4] and found it quite helpful - it
> will eliminate a lot of the messy conditional code one has to hack in order
> to support both languages.
> However, this library is not part of the standard python library.  This
> means introducing a new dependency.
> Personally, I don't think this is a big deal - use of 'six' is ubiquitous
> among python packages.  It's available freely via pypi, and though most
> distros.
> So that's the Big Question - is everyone comfortable with this additional
> dependency?   Does anyone have a better alternative?  Has anyone ported
> other large python codebases - what was your experience?
> thanks,
> -K
> [1] https://issues.apache.org/jira/browse/PROTON-490
> [2] http://python-future.org/index.html
> [3] http://python-future.org/futurize_cheatsheet.html
> [4] https://pythonhosted.org/six/

This makes sense to me, assuming the jython issues can be sorted. Would it
make sense to modify the build to automatically run the tests under both 2
and 3 to avoid introducing new code that only works on one version?


Reply via email to