Chapter 1, Introduction, Code Formatting, and Tools, is an introduction to the main tools you need to set up a development environment in Python. We cover the basics a Python developer is recommended to know to start working with the language, as well as some guidelines for maintaining readable code in the project, such as tools for static analysis, documentation, type checking, and code formatting.
Chapter 2, Pythonic Code, looks at the first idioms in Python, which we will continue to use in the following chapters. We cover the particular features of Python, how they should be used, and we start building knowledge around the idea that Pythonic code is in general much better quality code.
Chapter 3, General Traits of Good Code, reviews general principles of software engineering that focus on writing maintainable code. We explore the idea and apply the concepts with the tools in the language.
Chapter 4, The SOLID Principles, covers a set of design principles for object-oriented software design. This acronym is part of the language or jargon of software engineering, and we see how each one of them can be applied to Python. Arguably not all of them are entirely applicable due to the nature of the language.
Chapter 5, Using Decorators to Improve Our Code, looks at one of the greatest features of Python. After understanding how to create decorators (for functions and classes), we put them in action for reusing code, separating responsibilities, and creating more granular functions.
Chapter 6, Getting More Out of Our Objects with Descriptors, explores descriptors in Python, which take object-oriented design to a new level. While this is a feature more related to frameworks and tools, we can see how to improve the readability of our code with descriptors, and also reuse code.
Chapter 7, Using Generators, shows that generators are probably the best feature of Python. The fact that iteration is a core component of Python could make us think that it leads to a new programming paradigm. By using generators and iterators in general, we can think about the way we write our programs. With the lessons learned from generators, we go further and learn about coroutines in Python, and the basics of asynchronous programming.
Chapter 8, Unit Testing and Refactoring, discusses the importance of unit tests in any code base that claims to be maintainable. The chapter reviews the importance of unit tests, and we explore the main frameworks for this (unittest and pytest).
Chapter 9, Common Design Patterns, reviews how to implement the most common design patterns in Python, not from the point of view of solving a problem, but by examining how they solve problems by leveraging a better and more maintainable solution. The chapter mentions the peculiarities of Python that have made some of the design patterns invisible and takes a pragmatic approach to implement some of them.
Chapter 10, Clean Architecture, focuses on the idea that clean code is the base of a good architecture. All those details we mentioned in the first chapter, and everything else revisited along the way, will play a critical role in the entire design when the system is deployed.