【发布时间】:2011-09-28 10:28:15
【问题描述】:
我正在完成我一直在编写的 Python 包。然而,在我发布它之前,我想获得一些关于包的整体结构以及__init__.py 文件的反馈。
这应该可以让您了解我的__init__.py 文件是什么样子的。
'''
A docsting describing the package.
'''
__author__ = myname
__copyright__ = mycopyright
__credits__ = listofcredits
__license__ = mylicense
__version__ = 0.0
__maintainer__ = me
__email__ = myemail
__status__ = indevelopment
# This contains a module with directories as strings (for file reference)
import mypath
# some modules
import this
import that
# some gui widget classes
from windowmodule import windowwidget
from widgetmodule import someguiwidget
from someothermodule import someotherguiwidget, andanotherguiwidget
def __demo__ () :
# a demo of the package
if __name__ == '__main__' :
__demo__()
这应该可以很好地了解整个包结构。
mypackage/
mypath.py
__init__.py
license.txt
readme.txt
modules/
this.py
that.py
windows/
windowmodule.py
widgets/
widgetmodule.py
images/
imagefiles.whatever
tools/
tools.py
【问题讨论】:
-
这可能更适合codereview。
标签: python module package init