From a0e093ff388f564d8459c711a0a98bb25d68e950 2007-08-28 15:05:14 From: vivainio Date: 2007-08-28 15:05:14 Subject: [PATCH] add some config helpers to ipy_user_conf.py --- diff --git a/IPython/UserConfig/ipy_user_conf.py b/IPython/UserConfig/ipy_user_conf.py index 183a51c..a066c0c 100644 --- a/IPython/UserConfig/ipy_user_conf.py +++ b/IPython/UserConfig/ipy_user_conf.py @@ -24,6 +24,8 @@ ip = IPython.ipapi.get() # You probably want to uncomment this if you did %upgrade -nolegacy # import ipy_defaults +import os + def main(): # Handy tab-completers for %cd, %run, import etc. # Try commenting this out if you have completion problems/slowness @@ -39,5 +41,18 @@ def main(): # An example on how to set options #o.autocall = 1 o.system_verbose = 0 + + #import_all("os sys") + #execf('~/_ipython/ns.py') + +# some config helper functions you can use +def import_all(modules): + """ Usage: import_all("os sys") """ + for m in modules.split(): + ip.ex("from %s import *" % m) + +def execf(fname): + """ Execute a file in user namespace """ + ip.ex('execfile("%s")' % os.path.expanduser(fname)) main()