As we noted in the previous section, there's no essential need for a complex directory structure in a Python project. The ideal structure follows the standard library, and is a relatively flat list of modules. This will include overheads such as the setup.py and README files. This is pleasantly simple and easy to work with.
When the modules and packages get more complex, we'll often need to impose some structure. For complex applications, one common approach is to segregate Python code into a few bundles. To make the examples concrete, let's assume that our application is called my_app:
- my_app/src: This directory has all of the working application code. All of the various modules and packages are here. In some cases, there's only a single top-level package name in this src directory. In other cases, there...