2011-09-28 2 views
1

필자가 작성한 Python 패키지를 마무리하는 과정에 있습니다. 그러나 패키지를 배포하기 전에 패키지 전체 구조에 대한 피드백과 함께 __init__.py 파일을 얻고 싶습니다.내 Python 패키지 구조 비판

이렇게하면 내 __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 
+3

이것은 [codereview] (http://codereview.stackexchange.com/)에서 더 좋습니다. – SingleNegationElimination

답변

1

상대적인 가져 오기 대신 절대 가져 오기를 사용해야합니다. import mypackage.mypath as mypath.

+0

... 왜? 개인적인 취향입니까? –

관련 문제