Cover of Practices of the Python Pro by Dane Hillard, featuring abstract geometric shapes suggesting structured software layers

Pages

378

Published

2019

Python ✨ New

Practices of the Python Pro

Software design principles and best practices for intermediate Python developers

Move beyond working code and write Python that is maintainable, testable, and built to last.

Practices of the Python Pro teaches you the design principles and engineering habits that separate a working script from production-quality software. Dane Hillard walks through separation of concerns, abstraction, testing, and performance with concrete Python examples β€” giving intermediate developers the mental models they need to write code that other people can read, extend, and trust.

About this book

Getting Python code to run is the easy part. Getting it to stay readable six months later, survive a new team member, and scale without a rewrite β€” that takes a different kind of skill. Practices of the Python Pro closes that gap.

Dane Hillard has spent years watching talented developers plateau because no one taught them software design. This book is the course they never got. It covers the principles that experienced engineers apply instinctively: separation of concerns, loose coupling, high cohesion, abstraction, and encapsulation. Each principle is explained clearly, then demonstrated in Python code you would recognise from your own projects.

The book is not a tour of the standard library. It will not teach you syntax. What it will teach you is how to think about structure before you write the first function, how to recognise when a module is doing too much, and how to refactor toward clarity without breaking what already works.

You will also learn how to test your designs. The chapters on testing are not a pytest tutorial β€” they show you how testability is a design quality, and how writing tests forces you to confront the coupling and hidden dependencies you did not know were there.

Performance, packaging, and the practical mechanics of sharing code round out the later chapters, so you finish with a complete picture of what it means to ship software rather than just write it.

  • Design principles explained in plain language with Python examples throughout
  • Refactoring techniques that improve structure without breaking behaviour
  • Testing as a design tool, not an afterthought
  • Packaging and distribution so your work can be used by others
  • Performance measurement before optimisation

If you can write Python but feel unsure how to organise a real project, this book gives you the framework to make confident decisions and the vocabulary to explain them to your team.

🎯 What you'll learn

  • Apply separation of concerns so each module has one clear reason to change
  • Reduce coupling between components so you can modify one part without breaking another
  • Use abstraction and encapsulation to hide complexity behind clean interfaces
  • Refactor existing code toward better structure without changing observable behaviour
  • Write tests that expose design problems rather than just verify outputs
  • Measure performance before optimising so you fix the right bottleneck
  • Package and distribute Python code so others can install and use it reliably

πŸ‘€ Who is this book for?

  • Intermediate Python developers who write code that works but suspect it could be better organised
  • Self-taught programmers who never covered software design and want to fill that gap deliberately
  • Data scientists and analysts who are moving toward engineering roles and need production habits
  • Junior engineers preparing for their first code review with senior developers
  • Backend developers who have outgrown tutorials and want a principled approach to structuring projects

Table of contents

  1. 01

    Thinking About Design

    Establishes why software design matters beyond correctness, introducing the cost of poor structure through realistic Python examples you will return to throughout the book.

  2. 02

    Separation of Concerns

    Shows how to identify responsibilities inside a codebase and split them into focused modules and functions, reducing the cognitive load of every future change.

  3. 03

    Abstraction and Encapsulation

    Teaches you to hide implementation details behind stable interfaces, using classes and functions to expose only what callers need to know.

  4. 04

    Designing for High Performance

    Explains how to profile Python code to find real bottlenecks, then introduces data structures and algorithmic choices that make a measurable difference.

  5. 05

    Testing Your Software

    Reframes testing as a design activity: you will write tests that reveal hidden coupling and learn to structure code so that testing becomes straightforward rather than painful.

  6. 06

    Separation of Concerns in Practice

    Applies the earlier theory to a running case study, walking through the decisions involved in breaking a tangled module into well-defined layers.

  7. 07

    Extensibility and Flexibility

    Covers the open-closed principle and plugin patterns in Python, giving you techniques for adding behaviour without editing existing code.

  8. 08

    Keeping Things Loose

    Introduces dependency injection and inversion of control as practical tools for decoupling components and making them independently testable.

  9. 09

    Achieving Loose Coupling

    Consolidates the coupling concepts with worked examples of refactoring tightly coupled code, tracking the improvement in testability and clarity at each step.

  10. 10

    Packaging and Distribution

    Walks through the Python packaging ecosystem so you can structure a project, write a setup configuration, and publish code that other developers can install and depend on.

Frequently asked questions

Do I need to know Python before reading this book?

Yes. The book assumes you are comfortable writing Python functions, classes, and modules. It does not teach syntax or language basics β€” it teaches you what to do with the language once you know it.

Is this book relevant if I am not building web applications?

Completely. The design principles covered apply to any Python project: scripts, data pipelines, CLI tools, libraries, or services. The examples are general enough to map onto whatever you are building.

Does the book cover Python 3 specifically?

Yes, all code examples use Python 3. The book was published in late 2019, so examples reflect the Python 3 idioms current at that time, which remain valid and widely used.

Will this book teach me a specific framework like Django or FastAPI?

No. The book deliberately stays framework-agnostic so the principles transfer regardless of which tools you use. Framework-specific knowledge is not required and not the focus.

Is this suitable for someone preparing for a senior developer role?

It is a strong fit. The book covers the vocabulary and mental models that senior engineers use to evaluate design, which makes it useful both for producing better code and for discussing architecture with your team.

You might also like

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.