[Biopython-dev] Using PendingDeprecation for obsolete modules

Peter biopython at maubp.freeserve.co.uk
Thu Sep 17 08:02:18 EDT 2009


Hi all,

Right now we have deprecation process which usually looks like this:

(1) Label as obsolete in docstrings
(2) Label as deprecated in docstrings, issue DeprecationWarning
(3) Remove code

See: http://biopython.org/wiki/Deprecation_policy

I've relatively recently noticed the PendingDeprecationWarning warning
(added in Python 2.3), which is by default silent, but the user can choose
to enable it with the python command line switch -W. For example,

$ python
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.warn("X is obsolete", PendingDeprecationWarning)
>>>

So, by default, no warning message. But if you ask for them:

$ python -W allPython 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.warn("X is obsolete", PendingDeprecationWarning)
__main__:1: PendingDeprecationWarning: X is obsolete
>>>

So, I thinking what we should be doing for deprecating modules is:

(1) Label as obsolete in docstrings, issue PendingDeprecationWarning
(2) Label as deprecated in docstrings, issue DeprecationWarning
(3) Remove code

I guess very few people know about pending deprecation warnings,
and so are unlikely to even try using the warning switch. Therefore
I have little inclination to go though all the current modules tagged as
"obsolete" just to add this silent warning.

However, if simply start doing this in future, is really isn't any more work.

Any thoughts?

Peter


More information about the Biopython-dev mailing list