713
Comment: Initial page.
|
1231
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
The directory structure of your project should probably look something like this: {{{ my-project/ README.txt -- including list of contributors would be nice. CHANGES.txt -- including dates in addition to version numbers here would be informative. LICENSE.txt setup.py bin/ -- standalone scripts that this distribution provides my-project/ -- the source for your project goes here __init__.py my-stuff.py doc/ test/ }}} |
The topic of how to structure your project invokes lots of opinions. Generally speaking, the relatively agreed guidelines include: |
Line 18: | Line 3: |
The [[http://diveintopython3.org/packaging.html|packaging chapter]] of [[http://diveintopython3.org/|Dive Into Python 3]] has some useful information. | * 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. 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
- 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. Here are a couple:
packaging chapter of Dive Into Python 3 for some useful information.