Differences between revisions 9 and 10
Revision 9 as of 2019-06-20 20:38:29
Size: 255
Editor: IgorRocha
Comment: Diveintopython.net is no longer available. Replacing it for another mirror of the book.
Revision 10 as of 2019-07-17 19:29:53
Size: 1133
Editor: MatsWichmann
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
For now, see the [[https://www.cmi.ac.in/~madhavan/courses/prog2-2012/docs/diveintopython3/packaging.html|packaging chapter]] of [[https://www.cmi.ac.in/~madhavan/courses/prog2-2012/docs/diveintopython3/|Dive Into Python 3]] for some useful information. The topic of how to structure your project invokes lots of opinions. Generally speaking, the relatively agreed guidelines include:

 * if the project is a single source file, put it in the top level.
 * if you have tests, put them in a tests/ subdirectory (even if the project is a single source file), or if you have subdirectories and prefer to keep unit tests with code, put them there.
 * if you have an executable script to run your project, put it in a bin/ subdirectory, without the .py suffix even if it's a Python script
 * if you have many source files, create a subdirectory with the name of the project, and start populating there
 * create module directories as needed

The Python tutorial shows an example of a more complex layout: https://docs.python.org/3/tutorial/modules.html#packages

There are many many other places that describe a layout, not all agreeing. See [[https://www.cmi.ac.in/~madhavan/courses/prog2-2012/docs/diveintopython3/packaging.html|packaging chapter]] of [[https://www.cmi.ac.in/~madhavan/courses/prog2-2012/docs/diveintopython3/|Dive Into Python 3]] for some useful information.

The topic of how to structure your project invokes lots of opinions. Generally speaking, the relatively agreed guidelines include:

  • if the project is a single source file, put it in the top level.
  • if you have tests, put them in a tests/ subdirectory (even if the project is a single source file), or if you have subdirectories and prefer to keep unit tests with code, put them there.
  • if you have an executable script to run your project, put it in a bin/ subdirectory, without the .py suffix even if it's a Python script
  • if you have many source files, create a subdirectory with the name of the project, and start populating there
  • create module directories as needed

The Python tutorial shows an example of a more complex layout: https://docs.python.org/3/tutorial/modules.html#packages

There are many many other places that describe a layout, not all agreeing. See packaging chapter of Dive Into Python 3 for some useful information.

ProjectFileAndDirectoryLayout (last edited 2019-07-18 14:47:21 by MatsWichmann)

Unable to edit the page? See the FrontPage for instructions.