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 assetup.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.
- 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
md
orrst
) - 📁 📝 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
,django
etc.
- 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.