[Biopython-dev] Post Biopython 1.62 release, clean-up after dropping Python 2.5
Sergei Lebedev
superbobry at gmail.com
Fri Aug 30 18:53:53 EDT 2013
Peter, I've just submitted a PR [*] for #8 along with a 2to3 fixer which
does all the job, so I think I can take #9.
Sergei
[*] https://github.com/biopython/biopython/pull/230
On Fri, Aug 30, 2013 at 2:49 PM, Peter Cock <p.j.a.cock at googlemail.com>wrote:
> Hello Biopythoneers,
>
> I've outlined another relatively simple improvement for potential
> new contributors to try below....
>
> On Thu, Aug 29, 2013 at 5:33 PM, Peter Cock <p.j.a.cock at googlemail.com>
> wrote:
> >> 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).
> >>>
> >>> ...
> >>>
> >>> (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
>
> (7) was done by Chris Mitchell,
>
> https://github.com/biopython/biopython/commit/1d42f4dc07c8203a162d635b9bca5acb90204942
>
> > (8) Excluding doctests and the Tutorial, use print function
> > rather than print statement. e.g. replace this:
>
> (8) is being looked at by Sergei Lebedev.
>
> ----
>
> Here's another idea, under the general issue (5) of taking
> advantage of context managers (with statements), which
> I would judge to be fairly easy (but not trivial).
>
> (9) Use context managers (with statements) for temporary
> warning filters in the unit tests.
>
> Currently many of our unit tests add simple filters to ignore
> a warning, and then restore the old filters using pop(). This
> mostly works, but is fragile and the filter list is global so this
> can have strange side effects. See:
>
> $ grep "warnings." Tests/*.py
>
> The idea here is to replace this:
>
> warnings.simplefilter('ignore', PDBConstructionWarning)
> #some code which may trigger the warning
> warnings.filters.pop()
>
> with this:
>
> with warnings.catch_warnings():
> warnings.simplefilter("ignore", PDBConstructionWarning)
> #some code which may trigger the warning
>
> Note the indentation - these changes will not give nice
> clean diffs, so this will not be so easy to review.
>
> I would therefore suggest editing just one test file at a
> time (i.e. limit each commit to changing a single file), as
> that makes it easier to selectively apply your changes
>
> Please make sure you test this Python 2.6 which is most
> likely to have problems with this "new" style ;)
>
> (Again, if anyone plans to work on this, please let the list
> know to minimised duplicated effort.)
>
> If you're not familiar with our test suite, there is a chapter
> introducing this in the main Tutorial & Cookbook,
> http://biopython.org/DIST/docs/tutorial/Tutorial.html
>
> Thanks,
>
> Peter
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython-dev
>
More information about the Biopython-dev
mailing list