Files
awesome-python/website/data/category_intros/miscellaneous.md
T
2026-09-27 11:21:28 +08:00

1.8 KiB

Some helpers aren't in the standard library, so before writing your own Python utility library, check boltons. Blinker dispatches signals between modules.

How to choose:

  • Helpers the standard library lacks, like atomic file saves and chunked iteration: boltons
  • Events inside one process, between modules that don't import each other: Blinker

boltons is a set of pure-Python utilities missing from the standard library, like atomic file saves and chunked iteration. Run pip install boltons, then import what you need from its modules, e.g. from boltons.cacheutils import LRU. It depends on no other packages and its modules are self-contained, so you can also copy the whole package into your project, or just one module. Most modules aim to be good enough for basic uses. When you outgrow one, its docs often point to a third-party alternative.

Blinker lets any number of interested parties subscribe to events, or signals, inside one Python process. Create a named signal with signal('name'): every call with that name returns the same object, so modules and plugins share it without importing each other. Register receivers with connect(), and when you call send(), pass the object that emits the signal, usually self. A receiver can then subscribe to one sender only.