[Biopython-dev] PEP8 lower case module names?

Peter Cock p.j.a.cock at googlemail.com
Fri Oct 26 12:42:25 UTC 2012


On Fri, Oct 26, 2012 at 1:21 PM, Kai Blin
<kai.blin at biotech.uni-tuebingen.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2012-10-26 12:51, Peter Cock wrote:
>
> Hi Peter,
>
>> Indirectly it sounds like you like the lower case name idea - what
>> do you think about making this switch under Python 3? (This will
>> only inconvenience the relatively small number of early adopters
>> already trying Biopython under Python 3 - but it would be another
>> bump for people transitioning from Python 2 to 3).
>
> Actually, as someone who has to switch between BioPython and BioPerl a
> lot, I'd personally prefer if both libraries stayed as close as
> possible in their structure. In my opinion, the ability to easily
> switch between languages while using the Bio* libraries is one of the
> biggest features. As far as I understand we're just changing module
> names here, so all that'd be different would be the import lines.
>
> After reading thought this thread, I got the impression that there was
> a general agreement on switching to PEP8-compatible names eventually,
> and the remaining question was how to best do that.

Yes - hindered by the fact that due to file system limitations we can't
have multiple capitalisations of a given module at the same time.
Ideally we'd like to use bio.* as the namespace, and make this
switch as part of moving to Python 3 is one way to do that.

My personal preference is for a new lowercase namespace like
biopy.* or biopython.* which can co-exist with Bio.* during a
transition period. However, this did not seem popular.

> I haven't played with Python 3 much yet, but I have the impression
> that switching to it likely is going to be painful anyway. Even if the
> module renaming makes the transition a bit more painful, at least
> you've only got to go through the pain once.
>
> Assuming the translations between the 2.x and 3.x names can be done
> automatically by the conversion script, this sounds like a good idea.

That was my thinking - but it does go against the general advice
to library authors in that API changes from Python 2.x to 3.x are
discouraged.

We can of course stick with Bio.* as it is (which I believe is Brad's
favoured option). And I'm OK with this - it is the simplest option
(and doesn't prevent us doing some more minor changes if we
want to, such as reorganising all the Bio.SeqXXXX modules
under one directory).

Perhaps a blog post & email to the announcement mailing list
soliciting feedback on this proposal is the best way forward,
perhaps with a web-survey form? e.g.

(1) Keep the namespace as 'Bio'

(2) Keep the namespace as 'Bio' on Python 2,
but adopt all lowercase module names on Python 3.

(3) Move to a new all lowercase namespace like 'biopy'
(anything except 'bio'), allowing the current 'Bio' namespace
to continue to be available as well during a transition period.

And the most disruptive option:

(4) Switch to an all lowercase namespace 'bio', which
cannot in general co-exist with the old 'Bio' namespace
(perhaps bumping the version number to 2.0.0?). This
would break legacy scripts, which would need to be
updated, e.g.:

from Bio.SeqRecord import SeqRecord
from Bio import SeqIO

could be replaced by:

try:
    #Biopython 1.x uses Bio.*
    from Bio.SeqRecord import SeqRecord
    from Bio import SeqIO
except ImportError:




This would mean under Windows and most Mac install
you cannot have both
you (and all other users of the machine) m
must be remove

Regards,

Peter



More information about the Biopython-dev mailing list