No Starch Press asked me to do a technical review of one of their upcoming books, Serious Python: Black-Belt Advice on Deployment, Scalability, Testing, and More by Julien Danjou last year. I had never worked with No Starch before, but decided to give them a try and see how they differed from Packt Publishing. I ended up liking their process and the book was fun to read as well. It should be noted that No Starch did not ask me to do a book review. They only wanted me to do a technical review for them before the book was published.
I am writing this review because I think this book should get a little bit more notice. Also I interviewed its author a few years ago, so you might want to check that out too.
- Why I picked it up: Originally, the publisher asked me to do a technical review
- Why I finished it: The book covers intermediate level material and has an engaging writing style
- I’d give it to: Beginners that want to grow beyond just knowing Python’s syntax
You can get this book as a paperback, PDF, Mobi, or ePub.
This book contains 13 chapters across 240 pages. This book covers Python 2 and 3.
Serious Python is an interesting book. Let’s tart with chapter 1, which is about starting your project. This chapter covers the dos and don’ts of laying out your code project. You learn about version numbering and automated checks. Each chapter ends with an interview with someone in the Python community. For chapter 1, the interview is with Joshua Harlow.
Chapter 2 digs into modules, libraries and frameworks. Here you get an overview of how Python’s import system works. The author spends a couple of pages listing out useful standard libraries and also talks about using external libraries too. He even mentions safety practices when downloading from external resources and you learn about pip.
For chapter 3, you learn about writing good documentation and API with Sphinx. This chapter focuses almost exclusively on the Sphinx framework, which is what the Python team uses to document Python itself. You will learn about Sphinx modules and writing your own extensions to Sphinx here.
In chapter 4, the topic is timestamps and time zones. You will learn how to use Python’s datetime library as well as the super cool dateutil module, which is an external module for Python. The author also spends some time talking about serializing datetime objects and solving ambiguous times.
The topic of distributing your software is front and center in chapter 5. Here you will learn about using setup.py, setup.cfg and the wheel format. You will also discover how entry points work!
For chapter 6, you will dig into unit testing with Python’s unittest module. Julien cover regular unittest as well as mocks and then gets into how to use the tox automation project.
If you have been interested in decorators, static methods or class methods, then chapter 7 is for you. The entire chapter is devoted to these types of code constructs and goes one to talk about abstract methods too!
In chapter 8, Julien teaches the reader how useful Python is for doing functional programming. He focuses on generators, list comprehensions and Python’s builtins, such as map(), filter() and enumerate() among others.
The abstract syntax tree is the topic of choice for chapter 9. You will learn how to writing a program using AST as well as Hy, which is a dialect of Lisp that is embedded in Python. You can learn more about that project here. There is also a section about extending flake8 with AST.
For chapter 10, you will learn about performance and optimization. Here the author uses Python’s cProfile and the dis module to understand the behavior of your programs. The rest of the chapter covers various optimization techniques, such as using memoization, PyPy, buffers, etc.
In chapter 11, you will learn about scaling and architecture. The title of the chapter is a bit opaque in my opinion, as the actual topic is concurrency. Here you learn about Python threads, processes and asyncio. He also talks a little about ZeroMQ.
If you happen to be interesting in learning how Python works with relational databases, then you’ll want to check out chapter 12. Here the author talks about various database backends and shows an example of using Flask with PostgreSQL.
Finally in chapter 13, Julien covers using the six module to support writing your code for both Python 2 and 3. He also covers single dispatch and context managers in this chapter and then wraps it up by talking about the attrs package.
While some of topics that are covered seem pretty obvious, I don’t actually see very many authors or bloggers talking about them all that often. For example, I only hear about scaling on rare occasions and even concurrency articles don’t come out all that often. The only real fault I can think of here is that I might have arranged the chapters in a slightly different order than the way they ended up. I would give the book a chance and check it out if you’d like to learn more about any of the above topics!
Serious Python: Black-Belt Advice on Deployment, Scalability, Testing, and More
by Julien Danjou
Other Book Reviews
- Python Testing with pytest by Brian Okken
- Module Programming with Python by Erik Westra
- Python Playground – Geeky Projects for the Curious Programmer by Mahesh Venkitachalam
- IPython Notebook Essentials by L. Felipe Martins
- Creating Apps in Kivy by Dusty Phillips
- Kivy – Interactive Applications in Python by Roberto Ulloa
- Instant Flask Web Development by Ron DuPlain
- Real Python by Fletcher Heisler