Real Python·
Python Project Structure: How to Choose the Right Layout
TL;DR
Python project layouts affect imports, testing, and packaging, so the right choice depends on what you’re building. Use a flat layout for simple scripts and most applications, and prefer src/ for libraries or packaged applications that should be tested through installation; keep configuration at the root and organize code into clearly named packages. These defaults make projects easier to navigate and reduce import and packaging surprises.
Relevant links
Sign in to save links