[IPython-dev] Run code at startup
Sun Oct 30 13:58:51 CDT 2011
On Saturday, October 29, 2011 05:15:45 pm Fernando Perez wrote:
> On Sat, Oct 29, 2011 at 4:57 PM, Thomas Kluyver <email@example.com> wrote:
> > 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?
> No objection from me, I agree it's simpler both to explain and to do
> for users...
> For simplicity of the mental model, the semantics of putting foo.py in
> startup/ should be in every respect identical to those of adding it to
> exec_files. That is, files in startup/ should be run by the same code
> that handles the exec_files list, so the behavior regarding errors,
> listing of contents by %who, etc, is the same.
> It's basically a simpler way to set exec_files by having a
> conventional startup/ directory, which is OK by me.
(pasting from https://github.com/ipython/ipython/issues/914)
Min's implementation (e80f7aa) works for me for defining local magic.
Compared to finding and editing ipython_config.py, this is _way easier to figure out.
It might be nice to reference this in either the '%quickref' or '%magic' documentation
so that it's easy to discover from an interactive session.
More information about the IPython-dev