My easy button to master Python

“I will recommend this to fellow devs who wish to take their Python skills to next level. Thanks a lot Julien.” — Smital Desai

Buy Now Get the sample chapter

You have to put in the sweat, blood, and tears to become a jedi of Python. Maybe you think: If you skip the mistakes that others have made means you’re not good enough to write efficient code. It means you’re not worthy.


It just means everyone else knows a secret you don’t.

When they write code, they’re following specific battle-tested strategies and methods to leapfrog over mistakes. They get faster code with fewer errors.

You can, too.

“First advanced book on architecture about Python project that is clear, clever, and easy to read :)”
Amazon review

After I spent years working every day in Python, I compiled my best lessons into an ebook.

Get the sample chapter

Get the table of contents and a free chapter of the book. I promise that you’ll get an instantly actionable tip. Or I’ll make up for it by giving you a free 15-min “pick my brain” consult.

Download Sample Chapter

"How can this book help me?"

Best Practice

Methods & advice you should follow when writing your code and designing applications. These will help you get the most out of Python, and build future-proof programs. If you're already working on something, you'll be able to apply the techniques discussed right away to improve your current code.

Deep Down Diving

You will get introduced to some of the Python internals to get a better understanding of how to write efficient code. You will gain a greater insight into the inner workings of the language. You will be unbeatable about how Python works deep down.

Solving Problems

Battle-tested solutions to tackle problems such as testing, porting, or scaling Python code, applications and libraries. You will avoid making the mistakes that others have made, saving you time. You'll discover strategies that will help you maintain your software in the long run.

When you develop a Python application, there are hundreds of problems to solve

Code style
Database management
Dynamic code plug-in

This book offers shortcuts:

Here's what it includes:

Starting your project

Versions of Python
Laying Out Your Project
Version Numbering
Coding Style & Automated Checks

Modules, Libraries and Frameworks

The Import System
Useful Standard libraries
External libraries
Package Installation: Getting More From pip
Using and Choosing Frameworks

Documentation and Good API Practice

Documenting with Sphinx
Getting started with Sphinx and reST
Sphinx modules
Automating the Table of Contents with autosummary
Automating Testing with doctest
Writing a Sphinx Extension
Managing Changes to Your API

Handling Timestamps and Time Zones

The Problem of Missing Time Zones
Building Default datetime Objects
Time Zone-Aware Timestamps with dateutil
Serializing datetime Objects
Solving Ambiguous Times

Distributing Your Software

A Bit of History
Packaging with setup.cfg
The Wheel Format Distribution Standard
Sharing Your Work with the World
Entry points

Unit Testing

The Basics of Testing
Virtual Environments
Using virtualenv with tox

Methods and Decorators

Decorators and When to Use Them
How Methods Work in Python
Static methods
Class method
Abstract methods
Mixing Static, Class, and Abstract Methods
The Truth About super

Functional Programming

Creating Pure Functions
List comprehensions
Functional Functions Functioning
Using itertools Functions

The Abstract Syntax Tree, Hy, And Lisp-Like Attributes

Looking at the AST
Writing a Program Using the AST
Extending flake8 with AST checks
A Quick Introduction to Hy

Performances and Optimizations

Data Structures
Understanding Behavior Through Profiling
Definiting Functions Efficiently
Ordered Lists and Bisect
Namedtuple and Slots
Faster Python with PyPy
Achieving Zero Copy with the Buffer Protocol

Scaling and Architecture

Multithreading in Python and Its Limitations
Multiprocessing vs. Multithreading
Event-Driven Architecture
Other Options and asyncio
Service-Oriented Architecture
Interprocess Communication with ZeroMQ

Managing Relational Databases

RDBMS, ORMs, and When to Use Them
Database Backends
Streaming data with Flask and PostgreSQL

Write Less, Code More

Using Six for Python 2 and 3 Support
Using Python Like Lisp to Make a Single Dispatcher
Context Managers
Less Boilerplate with attr

Learn Straight From the Experts

Serious Python includes eight interviews from experienced Python developers. They share their know-how and wisdom on the various themes covered in the book.

Doug Hellmann

Doug is an open source programmer, working as a Senior Principal Software Engineer at Red Hat. He contributes to OpenStack, the largest open-source project using Python and wrote several Python books himself.

Nick Coghlan

Nick is a developer of the Python programming language; he's responsible for various feature that you'll use when programming with Python!

Christophe de Vienne

Christophe is a Python developer, responsible for various Python libraries and framework. He wrote a lot of very large Python application and maintained them during several years.

Robert Collins

Robert is a software engineer that worked on many Python libraries, especially in the unit and functional testing domain.

Victor Stinner

Victor is a long time CPython developer. He is well known in the community for working on making CPython faster and leads several performance-oriented projects. He likes to talk about optimizations, profiling, and performance when using Python, and how to make the right decisions.

Joshua Harlow

Joshua is a highly experienced engineer in distributed systems, working at GoDaddy. Josh is very knowledgeable on principles that make Python application resilient and faults tolerant as he wrote and maintained several of those over the years.

Dimitri Fontaine

Dimitri is a senior PostgreSQL contributor. He had the chance to work with a lots of Python developers and has a few opinions about how you should handle your database.

Paul Tagliamonte

Paul is a open source hacker and the creator of the Hy programming language, a Lisp inspired dialect of Python. Paul has a great understanding of the Python interpreter and its abstract syntax tree.


Who's the Author?

Hi, I'm Julien, a Free Software hacker for close to twenty years now. For more than 12 years, I've been developing software using Python.
I spent those last years as a Project Team Leader in OpenStack, a distributed cloud platform. It's the largest existing open-source Python code base (2.5 millions of lines of Python).
Today, I work at Datadog and runs my own company Mergify — where I write Python code everyday.

Julien Danjou

Staff Engineer at Datadog / Founder at Mergify

"A Must Read"

The readers of Serious Python (previously named The Hacker's Guide to Python) talk about it better than anyone else.

The best Functional Programming books of all time

Ready to master Python?

Money back guaranteed!

  •   The ebook in PDF, HTML, MOBI and EPUB formats
  •   8 experts interviews
  •   The ebook in PDF, HTML, MOBI and EPUB formats
  •   8 experts interviews
  •   Future editions of the ebook
  •   A ready-to-run Docker image with a Python environment, exercises, and samples to run as notebooks
  •   The ebook in PDF, HTML, MOBI and EPUB formats
  •   8 experts interviews
  •   Future editions of the ebook
  •   A ready-to-run Docker image with a Python environment, exercises, and samples to run as notebooks
  •   One hour of consulting time where I will review your project and advise you
  •   License to share with 20 members of your team

Frequently Asked Questions

Can I get a printed version?

My editor No Starch Press distributes a printed version that you can find on their Web site, on Amazon or in your favorite local book store (ISBN-13 978-1-59327-878-6).

What if the book is not for me?

If you think the book has no value to you, then I don't want your money. Ask me for a refund.

I need a license for more than 20 users.

Let's discuss this over email.

I probably need more than a book. Are you available for consulting?

Let's talk about that over email.

I have another question!

Send me an email.