由於生物資訊學和計算生物學發展迅速,一些先前開發的 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