随着生物信息学和计算生物学快速发展,一些以前开发的 Biopython 模块可能不再与当今世界相关。为了保持代码库的整洁,我们的目标是从 Biopython 中弃用并删除此类代码,同时避免对可能依赖旧代码的用户造成任何意外情况。
我们使用相同的流程来弃用过时的模块、方法、函数和类。
我们在 Biopython 源代码中保留一个纯文本文件来记录这些更改,名为 DEPRECATED.rst
。
这是当前从 Biopython 弃用和删除代码的策略
BiopythonDeprecationWarning
(Python 的 DeprecationWarning
默认情况下是静默的)import warnings
from Bio import BiopythonDeprecationWarning
warnings.warn(
"Bio.SomeModule has been deprecated, and we intend to remove it"
" in a future release of Biopython. Please use the SomeOtherModule"
" instead, as described in the Tutorial. If you would like to"
" continue using Bio.SomeModule, please contact the Biopython"
" developers via the mailing list or GitHub.",
BiopythonDeprecationWarning,
)
from Bio import SomeModule
,请将其替换为from Bio import BiopythonDeprecationWarning
with warnings.catch_warnings():
warnings.simplefilter("ignore", BiopythonDeprecationWarning)
from Bio import SomeModule
查看邮件列表上的讨论
http://lists.open-bio.org/pipermail/biopython-dev/2008-November/004920.html