Python Project File Structure

1. Overall Structure

  • project_root
    • src
      • git

      • ui
        • canvas
        • dashboard
    • ui
      • resources
    • doc
      • api
      • guide

2. Directory Details

2.1. project_root

All files that are part of the project. The directory should be named after the project itself, and should be the git repo root directory.

2.2. src

All python source modules, separated into packages where there is shared functionality. In PyCharm, the src folder must be marked as the “Sources Root” directory by right-clicking on it and selecting Mark Directory As > Sources Root.

2.2.1. git

Git data model and git command API.

2.2.2. ui

User interface.

2.3. ui

All of the .ui interface files generated by qt-designer. It contains a subfolder, called ‘resources’ that contains all resources referenced from .ui files or from code.

2.4. doc

All of the documentation generated for this project. Within it are two subfolders, ‘api’ and ‘guide’. ‘api’ contains API documentation (i.e. docs culled from sources), whereas the ‘guide’ folder contains our main documentation guide.