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.tomlfile can be omitted assetup.pycan have dependencies as well. pyproject.tomlcan 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.pyas well.
- This can be generated using
- 📁 data (OPTIONAL)
- Data for project.
- 📁 docs
tip
- This folder structure can be used as well. It will have src folder for more descriptive stature.
- 📁 src
- 📁 {PROJECT_NAME}
- 📁 src
- 📁 {PROJECT_NAME}
- 📝
__init__.py - 📝
__main__.py(OPTIONAL) => for calling withpython -m - 📁 utils
- 📁 service
- 📁 config
- 📝
- 📁 tests
- 📁 test of projects
- 📝 conftest.py
- 📝 LICENSE (OPTIONAL)
- 📝 README (can be
mdorrst) - 📁 📝 Other files/folders from third parties (OPTIONAL) such as tox.ini
- 📁 {PROJECT_NAME}
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,djangoetc.
- The framework recommended structure should be followed in such case. E.g.
- The OOP style cases of class as filename structue is not always necessary or recommended but can be used if needed.
Project Template
- Python Package Authority Sample can be used as bootstrap.
- Look into cookiecutter tool for template generation.