4 Project Structure and Imports

I’ve found that structuring a Python project is one of the most often overlooked components of teaching the language. Many developers therefore get their project structure wrong, stumbling through a jumble of common mistakes until they arrive at something that at least works.

Here’s the good news: you don’t have to be one of them!

In this chapter, I’ll introduce import statements, modules, and packages, and I’ll show you how to fit everything together without tearing your hair out.

Be aware, I’m skipping over one critical piece of project structure in this chapter: setup.cfg, as it relies on concepts we haven’t ...

Get Dead Simple Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.