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

Adam Sadovsky asadovsky at gmail.com
Thu Oct 31 01:32:52 EDT 2013


Hi Paul,

Thanks for the reply! The reason I'd like to avoid startup files is that
I'm trying to provide a library for others to use. As part of this library,
I want it to be possible for people to start a notebook server where any
new notebook has a certain set of things pre-imported for convenience. I
suppose I could provide a startup file for users to place in their own
startup dirs, but I'd like to avoid making users do any extra work. Ideally
I'd like an option similar to what's offered in the interactive shell API,
which allows users to pass in a user_ns object. Does that make sense?

I should say, I'm relatively new to IPython/notebook and not very familiar
with its architecture, so I certainly may be missing something obvious. :)


--Adam


On Wed, Oct 30, 2013 at 9:11 PM, Paul Ivanov <pi at berkeley.edu> wrote:

> 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
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20131030/24fcbf7c/attachment.html>


More information about the IPython-dev mailing list