Try starting the project using the python_boilerplate template. It largely follows the best practices (e.g. those here), but is better suited in case you find yourself willing to split your project into more than one egg at some point (and believe me, with anything but the simplest projects, you will. One common situation is where you have to use a locally-modified version of someone else's library).
Where do you put the source?
- For decently large projects it makes sense to split the source into several eggs. Each egg would go as a separate setuptools-layout under
PROJECT_ROOT/src/.
Where do you put application startup scripts?
- The ideal option is to have application startup script registered as an
entry_point in one of the eggs.
Where do you put the IDE project cruft?
- Depends on the IDE. Many of them keep their stuff in
PROJECT_ROOT/. in the root of the project, and this is fine.
Where do you put the unit/acceptance tests?
- Each egg has a separate set of tests, kept in its
PROJECT_ROOT/src//tests directory. I personally prefer to use py.test to run them.
Where do you put non-Python data such as config files?
- It depends. There can be different types of non-Python data.
- "Resources", i.e. data that must be packaged within an egg. This data goes into the corresponding egg directory, somewhere within package namespace. It can be used via the
pkg_resources package from setuptools, or since Python 3.7 via the importlib.resources module from the standard library.
- "Config-files", i.e. non-Python files that are to be regarded as external to the project source files, but have to be initialized with some values when application starts running. During development I prefer to keep such files in
PROJECT_ROOT/config. For deployment there can be various options. On Windows one can use %APP_DATA%//config, on Linux, /etc/ or /opt//config.
- Generated files, i.e. files that may be created or modified by the application during execution. I would prefer to keep them in
PROJECT_ROOT/var during development, and under /var during Linux deployment.
- Where do you put non-Python sources such as C++ for pyd/so binary extension modules?
- Into
PROJECT_ROOT/src//native
Documentation would typically go into PROJECT_ROOT/doc or PROJECT_ROOT/src//doc (this depends on whether you regard some of the eggs to be a separate large projects). Some additional configuration will be in files like PROJECT_ROOT/buildout.cfg and PROJECT_ROOT/setup.cfg.