Skip to content

Summary

✅ Use pyproject.toml for project and dependency management

✅ Use poetry or uv for managing dependency and versions

✅ Use tox or nox for environment automation in testing

✅ Use pytest for testing framework

❌ Avoid deeply nested namespaces (e.g. Java-style)

Structure

for simple projects.

.
├── app
├── tests
│   └── unit_tests
│   └── integration_tests
├── .flake8
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── pyproject.toml
├── README.md
└── Makefile

If your project is rather large, you may opt for the monorepo pattern

.
├── README.md
├── libs
│   ├── common-lib
│   ├── lib-one
│   └── lib-one
├── uv_or_poerty.lock
├── projects
│   ├── __init__.py
│   ├── project-one
│   └── project-two
└── pyproject.toml

under /projects

Project code (Python modules) go here. Each project has its own dependencies. Each project is considered to have its own releasable artifact.

under /libs

Each lib has its own dependencies. Each lib can optionally depends on the common-lib if there one.

project under /projects will use path import of the lib under /libs.