Critique my Python Package Structure
I'm in the process of finishing up a Python package I've been writing. However, before I release it I'd like to get some feedback on the overall structure of the package as well as the __init__.py
file.
This should give an idea of what my __init__.py
file looks like.
'''
A docsting describing the package.
'''
__author__ = myname
__copyright__ = mycopyright
__credits__ = listofcredits
__license__ 开发者_StackOverflow = 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__()
This should give a decent idea of the overall package structure.
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
You should use absolute imports instead of relative imports, e.g. import mypackage.mypath as mypath
.
精彩评论