[Python-ideas] Python Environment Initialization Scripts

James William Pye x at jwp.io
Sun Jul 29 02:47:31 CEST 2012


I posted a question on c.l.py[1] looking for a feature and I suspect it doesn't exist.
Some quick searches on -ideas and -dev didn't reveal anything either.

Has the idea of [python] environment initialization been pitched/rejected before or does it already exist?

Simply, I'm looking for a mechanism to automatically load some meta_path hooks after site initialization.

Without modifying libpython, I can achieve what I'm trying to do by:

 * Mangling the site.py file to run the code. (in my case, "import c.lib; c.lib.install()")
 * Overriding the python3 executable (not desirable; consider embedding)
 * Provide an alternate executable. (not desirable; again embedding and lack of availability in scripts pointing directly to python3) 
 * LD_PRELOAD overrides? (portability problems abound, I imagine. mangling seems preferable)
 * Perform installation in the dependent (duplication of installation in each dependent)

[1] https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/CCHe8_WHRt8


More information about the Python-ideas mailing list