[Biopython-dev] Biopython under PyPy
Peter Cock
p.j.a.cock at googlemail.com
Fri Sep 16 22:56:25 UTC 2011
On Fri, Sep 16, 2011 at 9:14 PM, Eric Talevich <eric.talevich at gmail.com> wrote:
> On Fri, Sep 16, 2011 at 1:07 PM, Peter Cock <p.j.a.cock at googlemail.com>
> wrote:
>>
>> Hi all,
>>
>> I've been trying Biopython under PyPy 1.6, and the unit tests for
>> a lot of things work fine. In the short term I'm skipping all the C
>> extensions (not clear how easy they will be under PyPy):
>>
>> https://github.com/biopython/biopython/commit/2a26ceebed01508a69aefd6a3a6437245347a5a2
>>
>
> Neato! Here's the relevant bug in Redmine:
> https://redmine.open-bio.org/issues/3236
Oh yeah - what I did to setup.py is almost the same.
>>
>> PyPy ships with a minimal numpy implementation, but it seems
>> to be very minimal - e.g. there is no dot function. This is actually
>> a bit annoying as "import numpy" works but you don't get everything!
>> Anyway, there are some easy checks we can add to individual
>> unit tests to skip them under pypy.
>
> Presumably this will get better in future releases of numpy,
> but yeah, it will be awkward to have to check that the numpy
> module not only exists, but is in fact the 'real' numpy.
I'm hoping we just need to check if it is good enough,
i.e. has the bits of numpy required for that module.
That's my aim with the test_*.py changes.
>> What is interesting is running the full test suite reports some
>> false positives (tests which when run on their own, or as part
>> of a smaller group pass), and the test suite itself never finishes:
>> error: Too many open files
>>
>> I'm not sure what this is from... I fixed an obvious handle leak:
>>
>> https://github.com/biopython/biopython/commit/f7ce81b3751745970c32cc813836507e93da3c30
>>
>> I suspect the problem is some of the individual tests are
>> leaking handles - which we know already from warnings
>> under Python 3 etc.
>
> Now that we've ditched Py2.4, we can start using context managers ('with')
> instead of explicit open/close. This should help ensure handles are closed
> when exceptions are raised.
Yeah - in the example above can you put the with statement
inside an if?
> The other noteworthy bug the unit tests uncovered, for me, was in
> test_Restriction. It wasn't clear at all to me why this error is raised --
> some subtle difference in magic-method access between implementations,
> maybe?
I'd noticed that too, and agree it probably falls into the
"too much magic" category :(
Peter
More information about the Biopython-dev
mailing list