A library is code distributed in such a way that strangers can use it. In this talk we consider: 1) why Python developers make bad libraries and poor APIs; 2) how to make your library API maximally useful for others; 3) examples of real-world antipatterns involving APIs.
Introduction and Guidelines
Why People Make Bad Libraries
Libraries vs. Frameworks vs. Apps
Convenience != "Cleanliness"
Global State is Precious
Module Scope Programming Antipatterns
Globals Mutation from Constructors
Functions Called for Side-Effects
Alternatives to Mutable Globals
Module Scope Configuration
Antipattern: Not-Really-Configuration
Antipattern: Inversion of Config Control
Avoid Convenience Features
Avoid Knobs on Knobs
The Danger of Offering Superclasses
The Yo-Yo Problem
Codependency
Smells
Alternatives to Inheritance
Composition
Event systems
First, Do No Harm