Home

A flock of typed, zero-dependency Python patterns. Pip one in, or copy one in and own the file.
Each pattern is a single self-contained pato (a duck). Adopt one, and you get a tiny,
fully typed, standard-library-only module that does one thing well. The flock is patos. A
single duck is a pato.
Two ways to use a pato¶
pip it in
Install the whole flock and import the patterns you want.
Why patos¶
- Typed. Every pato ships full type hints and
py.typed, so your checker sees through it. - Zero dependencies. Each duck is standard library only. Copying one in adds nothing to your lockfile.
- You own the code. The copy-in path gives you a small, readable module instead of a black box.
- One idea per duck. No god-objects, no framework. Reach for the one pattern you need.
The flock¶
Creational¶
Dispatch & selection¶
-
registry¶
Self-registering class hierarchies. Subclasses enroll through
__init_subclass__, anddispatchtries each one until it builds. -
strategy¶
A named family of interchangeable implementations, picked at runtime or by
first_available(). -
dispatch¶
Dispatch on a value the way
singledispatchdispatches on a type.