Folder and file organization for Python development

青春壹個敷衍的年華 提交于 2019-12-30 00:59:50

问题


What is the best way to organize code that belongs to the same project in a Python development environment? What are the do and donts of Python project organization? Do you separate each class in a file?

Project A
   Classes
       "subsystem1"
           class1
           class2
           subsystem1Module
       "subsystem2"
       "utils"
       "etc"
   Tests
   Whatever
   etc?

Any suggestions? Oh, and please describe what are the (possible) problems of each type of organization.

What are considered best practices for organizing Python code?


回答1:


Some suggestions are at http://jcalderone.livejournal.com/39794.html and http://infinitemonkeycorps.net/docs/pph/




回答2:


There are not that many issues that are going to be applicable only to Python. This website: Software Configuration Management Patterns and the associate book describes some Source Code Management patterns.

The issues are described in the familiar patterns language so you should be able to find the information you need for your requirements. As with all patterns there is also discussion on the trade-offs.



来源:https://stackoverflow.com/questions/1642975/folder-and-file-organization-for-python-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!