向skbio添加新模块

每个模块需要一个 __init__.py file and a tests folder that also contains an `_ _inituuuy.py`文件。对于一个模块,一个简单的模块可能如下所示:

r"""
A module (:mod:`skbio.module`)
==============================

.. currentmodule:: skbio.module

Documentation for this module.
"""

# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------------------------------------------------------------

from skbio.util import TestRunner
test = TestRunner(__file__).test

通常,通过导入模块,可以访问模块中的某些功能 __init__.py . 使用显式的相对导入很方便 (from .implementation import compute )在一个文件包中,用户不能整齐地嵌套在不同的功能中,这样就不会有不同的功能: from skbio.module import compute 而不是 from skbio.module.implementation import compute .

在tests文件夹中,一个更简单的 __init__.py 工作正常(有必要在安装后运行所有测试):

# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------------------------------------------------------------

最后,记住也要遵循 documentation guidelines .