Skip to main content

Project Structure and Templates

The following folder structure should be used for projects:

  • 📁 Project Root:
    • 📝 pyproject.toml
    • 📝 setup.py and 📝 setup.cfg (OPTIONAL)
info
  • If not using poetry, pyproject.toml file can be omitted as setup.py can have dependencies as well.
  • pyproject.toml can be used for alternate build system if needed.
    • 📁 docs
      • Your documentation
    • 📁 bin (OPTIONAL) => For entrypoint scripts which calls {PROJECT_NAME}
      • This can be generated using setup.py as well.
    • 📁 data (OPTIONAL)
      • Data for project.
tip
  • This folder structure can be used as well. It will have src folder for more descriptive stature.
    • 📁 src
      • 📁 {PROJECT_NAME}
    • 📁 {PROJECT_NAME}
      • 📝 __init__.py
      • 📝 __main__.py (OPTIONAL) => for calling with python -m
      • 📁 utils
      • 📁 service
      • 📁 config
    • 📁 tests
      • 📁 test of projects
      • 📝 conftest.py
    • 📝 LICENSE (OPTIONAL)
    • 📝 README (can be md or rst)
    • 📁 📝 Other files/folders from third parties (OPTIONAL) such as tox.ini
note
  • There can be cases where MVC folder structure as well as framework related folder structure can be used.
    • The framework recommended structure should be followed in such case. E.g. flask, django etc.
  • The OOP style cases of class as filename structue is not always necessary or recommended but can be used if needed.

Project Template