He explained that pkg_resources takes 300 ms to load. It basically examines your whole sys.path on import. Pretty annoying when all you want to use it for is just to resolve a path relative to your egg.
So ok, *that* import you can put deep in your function. Otherwise I prefer them all to be at the top and pretend they're declarative.
Looked around and found this still-open issue from last year. Potentially it takes over a second to import, depending on what's on your sys.path and whether your eggs are zipped, etc:
> with pkg_resources, 244 ms > without pkg_resources, 2.65 ms
> So just by importing pkg_resources, the slowdown is ~100x. In wall clock time, I have consistently tested the pkg_resources overhead to be at least 150 - 200 ms. This makes pkg_resoucres (sic!) unusable in command line utilities that require fast start up times.