[IPython-dev] Run code at startup

Thomas Kluyver takowl at gmail.com
Sat Oct 29 19:57:10 EDT 2011


One of the commonest uses of config files is to specify code to be run in
IPython's startup, e.g. to define extra magic commands, or to import modules
in the user namespace. At present, this is a bit awkward: you can embed your
code within a string in exec_lines, or you can save it in a separate file
and add it to exec_files. In both cases, users might also get caught out by
the inheritance that allows separate or joint configuration of the terminal
and the ZMQShell.

I proposed in #914 that we offer a simpler way to do this. Min's written a
neat implementation that will check for .py and .ipy files in a directory
like .ipython/profile_default/startup/ . I think this is a big improvement -
if people want a custom magic command, they can simply drop a file into a
folder, without delving into the config at all. Does anyone see a reason not
to add this feature?

The code can be seen here:
https://github.com/minrk/ipython/compare/ipython:master...minrk:startup

Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20111030/2e205c1b/attachment.html>


More information about the IPython-dev mailing list