ipy_user_conf.py
82 lines
| 2.3 KiB
| text/x-python
|
PythonLexer
|
r130 | """ User configuration file for IPython | ||
This is a more flexible and safe way to configure ipython than *rc files | ||||
(ipythonrc, ipythonrc-pysh etc.) | ||||
|
r176 | This file is always imported on ipython startup. You can import the | ||
|
r130 | ipython extensions you need here (see IPython/Extensions directory). | ||
|
r176 | Feel free to edit this file to customize your ipython experience. | ||
Note that as such this file does nothing, for backwards compatibility. | ||||
|
r195 | Consult e.g. file 'ipy_profile_sh.py' for an example of the things | ||
you can do here. | ||||
|
r131 | |||
|
r492 | See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed | ||
description on what you could do here. | ||||
|
r130 | """ | ||
|
r131 | # Most of your config files and extensions will probably start with this import | ||
|
r130 | |||
|
r195 | import IPython.ipapi | ||
ip = IPython.ipapi.get() | ||||
|
r176 | |||
|
r205 | # You probably want to uncomment this if you did %upgrade -nolegacy | ||
|
r284 | # import ipy_defaults | ||
|
r205 | |||
|
r808 | import os | ||
|
r176 | def main(): | ||
|
r403 | # Handy tab-completers for %cd, %run, import etc. | ||
# Try commenting this out if you have completion problems/slowness | ||||
|
r621 | # import ipy_stock_completers | ||
|
r507 | |||
# uncomment if you want to get ipython -p sh behaviour | ||||
# without having to use command line switches | ||||
# import ipy_profile_sh | ||||
|
r403 | |||
|
r844 | # Configure your favourite editor? | ||
# Good idea e.g. for %edit os.path.isfile | ||||
#import ipy_editors | ||||
|
r846 | |||
# Choose one of these: | ||||
|
r844 | #ipy_editors.scite() | ||
#ipy_editors.scite('c:/opt/scite/scite.exe') | ||||
#ipy_editors.komodo() | ||||
|
r848 | #ipy_editors.idle() | ||
# ... or many others, try 'ipy_editors??' after import to see them | ||||
|
r846 | |||
# Or roll your own: | ||||
|
r844 | #ipy_editors.install_editor("c:/opt/jed +$line $file") | ||
|
r284 | o = ip.options | ||
|
r195 | # An example on how to set options | ||
#o.autocall = 1 | ||||
|
r507 | o.system_verbose = 0 | ||
|
r808 | |||
#import_all("os sys") | ||||
#execf('~/_ipython/ns.py') | ||||
|
r895 | # A different, more compact set of prompts from the default ones, that | ||
# always show your current location in the filesystem: | ||||
#o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>' | ||||
#o.prompt_in2 = r'.\D: ' | ||||
#o.prompt_out = r'[\#] ' | ||||
|
r808 | # 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)) | ||||
|
r134 | |||
|
r195 | main() | ||