[Biopython-dev] Post Biopython 1.62 release, clean-up after dropping Python 2.5

Peter Cock p.j.a.cock at googlemail.com
Thu Aug 29 16:33:43 UTC 2013


> On Wed, Aug 28, 2013 at 7:53 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>> Hello all - especially newcomers,
>>
>> There are going to be several boring but useful things to do to
>> the Biopython code base once we're finished with Python 2.5
>> (the imminent release of Biopython 1.62 has been clearly
>> described as the final Biopython release to support it).
>>
>> Some of these tasks are quite easy, and might tempt some
>> of our non-core contributors or new-comers to have a go,
>> however to avoid too much duplication of effort I'd suggest
>> **replying in this thread if you want to tackle anything** - and
>> then start working out how to send us your first pull request.
>>
>> Things which will need doing:
>>
>> (0) Disable the Python 2.5 and Jython 2.5 buildbot
>> (this will be done by me or Tiago)
>
> Done.
>
>> (1) Disable the Python 2.5 target in TravisCI, see
>> https://travis-ci.org/biopython/biopython/
>> (this is a simple one line edit to the .travis.yml file)
>
> Done by Wayne,
> https://github.com/biopython/biopython/commit/d134b3ae6d963b81510c40c621d640ee00b6f3de
>
>> (2) Remove all the with statement imports (and any
>> comment lines associated with them):
>>
>> from __future__ import with_statement
>
> Done by Wayne,
> https://github.com/biopython/biopython/commit/eeab501987de61ae5935153e1b1a0b225878cb84
>
>> (3) Remove Bio/_py3k/_namedtuple.py and adjust
>> import lines accordingly

(3) was a false alarm, just an old file on my latop confusing me.

>> (4) Scan over the code base looking for any comments
>> about Python 2.5 (e.g. using the grep command), and
>> reviewing them one by one to see if there is an old
>> workaround we can now remove.
>
> Lenna had a quick look, there should be some easy one here.
>
>> (5) More advanced code review, for example looking
>> for places we can better take advantage of context
>> managers (with statements) for file handles.
>
> Another new one, related to (5), and fairly easy:
>
> (6) Reviewing examples in the docstrings and Tutorial
> where it would make sense to use a 'with' for file handles.
>
> This should also solve many of the ResourceWarning:
> unclosed file ... warnings visible running the full test
> suite under Python 3, e.g. see:
> http://testing.open-bio.org/biopython/builders/Linux%2064%20-%20Python%203.3/builds/298/steps/shell/logs/stdio

On Thu, Aug 29, 2013 at 11:30 AM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> ... I have come up with another easy task instead,
>
> (7) Update exception style from this,
>
> except ErrorClass, variable_name:
>
> to this:
>
> except ErrorClass as variable_name:
>
> The second form is the only allowed syntax in Python 3,
> but was not possible under Python 2.5.

(7) is being tackled by Chris Mitchell,
https://github.com/biopython/biopython/pull/227

Here's another fairly easy task for another new volunteer?:

(8) Excluding doctests and the Tutorial, use print function
rather than print statement. e.g. replace this:

print variable1, variable2

with this:

from __future__ import print_function
...
print(variable1, variable2)

Note that I am deliberately not suggesting we switch the
user visible examples on our documentation yet - that
deserves some discussion first.

Peter



More information about the Biopython-dev mailing list