[IPython-dev] How to preconfigure notebook environment in v1.1?

Paul Ivanov pi at berkeley.edu
Thu Oct 31 00:11:09 EDT 2013


Adam Sadovsky, on 2013-10-30 20:28,  wrote:
> I recently upgraded from IPython 0.13 to 1.1.
> In 0.13, I was able to execute code in each notebook at startup, but the
> kernel code has changed and I can't figure out how to do it anymore. Could
> someone point me in the right direction?

Hi Adam,

why not just use a file in the startup directory?

$ echo `ipython locate profile`/startup/
/home/pi/.ipython/profile_default/startup/
$ cat `ipython locate profile`/startup/README
This is the IPython startup directory

.py and .ipy files in this directory will be run *prior* to any
code or files specified
via the exec_lines or exec_files configurables whenever you load
this profile.

Files will be run in lexicographical order, so you can control
the execution order of files
with a prefix, e.g.::

  00-first.py
  50-middle.py
  99-last.ipy
  
best,
-- 
                   _
                  / \
                A*   \^   -
             ,./   _.`\\ / \
            / ,--.S    \/   \
           /  `"~,_     \    \
     __o           ?
   _ \<,_         /:\
--(_)/-(_)----.../ | \
--------------.......J
Paul Ivanov
http://pirsquared.org



More information about the IPython-dev mailing list