[Biopython-dev] Python 3 porting

Peter biopython at maubp.freeserve.co.uk
Tue Jul 6 10:03:29 UTC 2010


On Mon, Jul 5, 2010 at 7:16 PM, Peter <biopython at maubp.freeserve.co.uk> wrote:
> Hi all,
>
> While Tiago and I have sorted out some of the easy stuff, there is still plenty
> to do make Biopython via 2to3 work nicely on Python 3 (and that's just looking
> at the Python code, ignoring our C code, and also ignoring things using NumPy).

I can get SFF output working - first by using the new io.BytesIO
module (in Python
2.6+ as well) in place of StringIO for testing writing binary files
(i.e. SFF output).
This also requires a sprinkling of decode/encode calls in SffIO.py when reading/
writing the binary file - I'm not sure how to get that automatically with 2to3.

Note that the SeqRecord's format method can currently return a single read in
SFF file as a binary string. This won't be so sensible on Python 3 where a
byte string makes more sense than unicode, so I think we should deprecate
supporting binary files (i.e. SFF) in the SeqRecord's format method.

> We still have quite a few warnings using the -3 switch on Python 2.6 or 2.7
> which we should probably concentrate on first.

A lot of these are with changes to object comparison (the __cmp__ method
is no more), which will need a little extra care, and the related issue of using
cmp in list sorting (again, not supported anymore).

Peter



More information about the Biopython-dev mailing list