On Jul 28, 2012, at 5:56 PM, Eric Snow <ericsnowcurrently@gmail.com> wrote:
No need to modify site.py. Either create a sitecustomize.py in your site-packages.
I had recently forgotten about that. Thanks. =) However, from the documentation: "After these path manipulations, an attempt is made to import a module named site customize," "which can perform arbitrary site-specific customizations. It is typically created by a system "administrator in the site-packages directory." The "It is typically created by a system administrator" part is what worries me about using sitecustomize.py. In order for this to be automatic, the package containing the meta_path hook would have to install/setup sitecustomize.py upon `pip install metapathawesomeness` which may already be in use by the system administrator. That is, based on the above documentation, it doesn't seem appropriate for a package to presume that it can use sitecustomize.py in such a way.
As to metapath hooks, one alternative is to make a helper function that puts the hooks in place (or otherwise manages your hooks). Then you can call that API in each script that needs those hooks.
Yeah, I referred to that in my list of alternatives. My gripe with it is the duplication across the set of dependent scripts/packages. However, it would seem to be the most appropriate solution ATM. =\