Skip to main content

Tag: ipython

Separate IPython profiles for interactive use

I used to have two simple shell aliases for IPython: alias ipy=ipython alias pylab='ipython --pylab' These were separated for a couple of reasons: The pylab mode of IPython was deprecated, for good reason. It “infects” the global namespace with all matplotlib and numpy functions. It breaks two entries in the famous “Zen of Python”: Explicit is better than implicit. Namespaces are one honking great idea – let’s do more of those!

Adding module imports to iPython startup

I’m constantly opening an iPython interpreter and having to import my common modules (for me pyfits mostly). The easiest way to import modules on iPython startup is to look in your ~/.ipython/ipy_user_conf.py file which is a nice easy way to add python code into your ipython startup (as opposed to the ipythonrc file which is about colours etc.). In the main function, just add a line such as ip.ex("import pyfits") This will allow custom code to be run at startup.