[Biopython-dev] 2to3 ramblings
Frank Kauff
fkauff at biologie.uni-kl.de
Mon Jul 5 07:46:59 UTC 2010
Hi Tiago,
On 07/04/2010 10:24 PM, Tiago Antão wrote:
> Hi,
>
> Here are my findings on the attempt of converting biopython to python 3.
> ...
>
> Biggest issues have been with Nexus and, above all, Sff (mostly 13
> above - encoding formats).
>
>
I'd be happy to help with Nexus.py. You have some sort of list with the
lines that failed?
Frank
> With the exception of Sff, I think I could easily sort out everything myself.
>
> The big incognito seems to be the C code. But I will assume that
> conversion is easy for the rest of the discussion. I have also to test
> process code that executes external apps.
>
>
> > From my point of view the conversion is not the big issue. The big
> issue is the maintenance of a version that works on both 2 and 3 at
> the same time (we dont want to maintain 2 codebases, correct?).
> Somethings are easy, but some are unknowns. It is possible to make
> _some_ code (that currently works only on 2) work on both pythons with
> little effort. Other code (e.g. prints) can be automatically converted
> on build. But some issues are still unknown to me.
>
> What numpy does (at least partially) is, on build: if python 3 is
> detected then call 2to3 to convert a python2 codebase to python3.
> Seems to work quite well. My gut feeling is that code of the form
> if python.version==2:
> a_version
> else:
> b_version
> can be almost non-existent.
> But it is just a gut feeling.
>
> So I think the python codebase can be easily shared between python 2
> and 3 with little ugliness. About the C codebase? I don' t have any
> idea for now.
>
> This is not as much work as it seems. I think it is possible to have
> almost everything working on python3 for BOSC (assuming the current
> pace). But again, the main issue is not the conversion but maintaining
> a single code base. In practice, I think the first step is to have a
> build system like numpy: which detects the python version and calls
> 2to3. A single code base that can be built and tested on both 2 and 3.
>
>
> Suggested readings
> http://coderazzi.net/tnotes/python/migrating2to3.html
> http://diveintopython3.org/porting-code-to-python-3-with-2to3.html
> http://dbaktiar.wordpress.com/2009/08/20/python-3-1-file-open-is-no-longer-binary-by-default/
>
>
> Well, these are my 0.02£. I can work on putting a github version of
> this if you are interested...
>
>
More information about the Biopython-dev
mailing list