It is rather cumbersome at the moment to create a new notebook whose contents are initialized to those of an existing notebook. Users may be tempted to just copy to the ipynb file, but this rapidly creates a mess because the name of a notebook is stored in the notebook itself and thus needs to be changed in the copy.
It would be nice to have a "Clone" operation in the "Actions" panel, next to "New".
Thanks, @ellisonbg, it's indeed a very valid request. Thanks for the feedback, Konrad! Glad to see you on github :)
Once this works it might make sense to have a list of "templates" that area always visible - I always use the same preamble, importing numpy, scipy, and matplotlib, and switching to svg mode.
@aarchiba, note that you can configure your mpl inline backend to always use the svg backend, and if you start the notebook with --pylab inline, you don't need to import numpy as np nor pyplot as plt explicitly, as they are done for you. This will let you have in your #1 cell just the imports specific to the actual problem you're working on.
numpy as np
pyplot as plt
You can drop this:
c = get_config()
c.IPKernelApp.exec_lines = [
"from IPython.zmq.pylab import backend_inline",
"cfg = backend_inline.InlineBackendConfig.instance()",
"cfg.figure_format = 'svg'"
into a file named ipython_notebook_config.py in your ~/.ipython/profile_default directory, and that will do the trick. That, and an alias like
alias ipnb='ipython notebook --pylab=inline'
should take care of this part of the boilerplate.
Not that your suggestion isn't valid in general, just providing an immediate solution for part of it.
Note: the above can be written more cleanly with a regular multiline string:
c = get_config()
c.IPKernelApp.exec_lines = ["""
from IPython.zmq.pylab import backend_inline
cfg = backend_inline.InlineBackendConfig.instance()
cfg.figure_format = 'svg'
And just for the sake of completeness, as pointed out in #735, you can just do
c.InlineBackendConfig.figure_format = 'svg'
The problem with all of these is that I want my exported notebooks to be standalone - so that people can just grab the python code and run it in a plain interpreter, or in an ipython notebook of their own. If I move all sorts of setup into my config files, it lurks as a surprise for people trying to use my notebooks...
SVG mode is obviously an exception, but it also seems like something there should be UI for...
Yup, we've been talking about this already quite a bit in #892. I just opened it as #903 so we don't let it slip by. Needless to say, pull requests will be warmly received :)
This is fixed in master