Re: How to load an extension into every notebook on a server
Thomas Kluyver <[email protected]>
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CAOvn4qgeSpaVVRW4h+jzn19gB6tTXkuY=QvfK2JLDmqso9MFaQ@mail.gmail.com> |
Looking at the Genepattern code [1], it's using display() to publish data. The notebook interface will only actually use the Javascript that sends if it's coming from code run in a cell, so that part of the loading can't work at startup. I think we'd probably encourage you to keep putting the command to load the extension at the top of every notebook, by analogy with a similar situation we had with pylab. It used to be possible to run "ipython notebook --pylab", and have a lot of numpy & matplotlib functions pre-loaded into the namespace. But this produces notebooks which can only be run by someone starting the notebook server in the same way. We found it better to use a '%pylab' magic inside the notebook when we want the namespace set up like that. I think loading the genepattern extension is a similar thing: it's clearer what's going on when that lives inside the notebook, rather than hidden in your config. [1] https://github.com/genepattern/genepattern-notebook/blob/master/profile/extensions/genepattern.py Thomas On 23 December 2015 at 22:06, Ted Liefeld <[email protected]> wrote: > I am building a Docker image to have a Jupyter server with the GenePattern > notebook extension in it. So far so good except that in every notebook I > have to enter > > %reload_ext genepattern > > into the first cell to make the extension active. I have been prowling > through the docs and have tried putting this command in lots of places, > none of which have worked (e.g. ~/.jupyter/jupyter_notebook_config.py, > ~/.ipython/profile_default/startup/ipython_notebook_config.py) both > normally (ie as above) and also as a config setting > c.InteractiveShellApp.exec_lines = ['%reload_ext genepattern'] > > It seems with all the layers of config I am not finding the right one to > insert this at. Can anyone point me in the right direction? My current > container is using Jupyter 4.0.6, IPython 4.0.1 and Python 3.4.3. > > Thanks > > Ted > > > -- > Ted Liefeld UC San Diego > Mesirov Lab [email protected] > > Office 2A24, BRF-II 858-534-2010 > > > _______________________________________________ > IPython-dev mailing list > [email protected] > https://mail.scipy.org/mailman/listinfo/ipython-dev > > _______________________________________________ IPython-dev mailing list [email protected] https://mail.scipy.org/mailman/listinfo/ipython-dev