Now and then I'll just dig up some old standard creative coding technique, make a solid, reusable function for it, and add it to my libraries. Circle packing was not in there yet. It is now.
most of my code libraries are contained in two modules. blcairo, which is all rendering code. It's got the cairographics bindings. And bitlib, which is pretty much everything else, but knows nothing about rendering. The biggest part of that is probably geom, which has points, lines, circles, rectangles, polygons, all kinds of shapes - but only as models of shapes. blcairo knows how to render them all.
This circle packing just returns lists of circles, which makes it very flexible.