Differences between revisions 11 and 13 (spanning 2 versions)
Revision 11 as of 2019-07-17 19:31:21
Size: 1157
Editor: MatsWichmann
Comment:
Revision 13 as of 2019-07-18 14:47:21
Size: 1387
Editor: MatsWichmann
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
 * include a doc/ directory (you have docs, right?)
Line 8: Line 9:

These guidelines are partly convention, partly because they align well with Python packaging tools.
Line 11: Line 14:
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/packaging.html#structure|Dive Into Python 3]] for some useful information.
There are many many other places that describe a layout, not all agreeing. Here are a couple:
 *
[[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/packaging.html#structure|Dive Into Python 3]] for some useful information.
 * https://realpython.com/python-application-layouts

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
  • include a doc/ directory (you have docs, right?)
  • create module directories as needed

These guidelines are partly convention, partly because they align well with Python packaging tools.

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. Here are a couple:

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

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