[Biopython-dev] Bug#747494: python3-biopython: Does not use C implementations of cpairwise2 functions

Peter Cock p.j.a.cock at googlemail.com
Fri May 9 12:36:32 UTC 2014


Hi Andreas,

This was reported directly to Biopython and fixed two months ago:
https://github.com/biopython/biopython/pull/299
https://github.com/biopython/biopython/commit/daf3e3b5ba317fbbea1f7eebae3c5f8b06a40d6b

If you want to apply the one line fix to Biopython 1.63 for the Debian
Python 3 package, that would be great. Otherwise (under Python 3)
the optimised C code is never used, just the pure Python fallback.

(Note I'm hoping we can get Biopython 1.64 out later this month.)

On a separate note, is there a mechanism to alert upstream projects
(in this case Biopython) when a bug is reported in the Debian package?

Thanks,

Peter


On Fri, May 9, 2014 at 12:55 PM, Andreas Tille <andreas at an3as.eu> wrote:
> Hi,
>
> while I have just closed this bug report since I assumed it was a wrong
> usage of the import statement I would like to forward this issue to
> upstream Biopython developers anyway.  It seems there are cases when
> cpairwise2 is not used and things might work slower than necessary.
>
> I just forward this for your consideration to make sure that everything
> works as expected from your side.
>
> Kind regards
>
>         Andreas.
>
> On Fri, May 09, 2014 at 01:32:37PM +0200, Jakub Wilk wrote:
>> * Andreas Tille <andreas at an3as.eu>, 2014-05-09, 13:15:
>> >thanks for your bug report.  I think this should work out of the
>> >box but I personally not comfortable with cpython to know how this
>> >could be fixed.  I keep the Debian Python list in CC - perhaps
>> >they might have some helpful advise.
>>
>> The relvant code in Bio/pairwaise2.py is:
>>
>> # Try and load C implementations of functions.  If I can't,
>> # then just ignore and use the pure python implementations.
>> try:
>>    from cpairwise2 import rint, _make_score_matrix_fast
>> except ImportError:
>>    pass
>>
>> But in Python 3 imports as always absolute, unless explicitly
>> requested, so the import fails, and this code snippet is no-op.
>> Changing the import line to:
>>
>>    from .cpairwise2 import rint, _make_score_matrix_fast
>>
>> should do the trick.
>>
>> Before:
>> $ python3 -c 'from Bio.pairwise2 import rint; print(rint.__module__)'
>> Bio.pairwise2
>>
>> After:
>> $ python3 -c 'from Bio.pairwise2 import rint; print(rint.__module__)'
>> Bio.cpairwise2
>>
>> >It seems this module is not affected by the test suite since this
>> >runs fine.
>>
>> Yeah, as the code comment says, if the import fails, everything(?)
>> still works, just slower.
>>
>> --
>> Jakub Wilk
>>



More information about the Biopython-dev mailing list