Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Users should be able to clone a notebook #781

Closed
khinsen opened this Issue · 9 comments

4 participants

khinsen Brian E. Granger Fernando Perez Anne Archibald
khinsen

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".

Brian E. Granger
Owner
Fernando Perez
Owner

Thanks, @ellisonbg, it's indeed a very valid request. Thanks for the feedback, Konrad! Glad to see you on github :)

Anne Archibald

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.

Fernando Perez
Owner

@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.

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.

Fernando Perez
Owner

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'
"""
]
Fernando Perez
Owner

And just for the sake of completeness, as pointed out in #735, you can just do

c.InlineBackendConfig.figure_format = 'svg'
Anne Archibald

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...

Fernando Perez
Owner

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 :)

Brian E. Granger
Owner

This is fixed in master

Brian E. Granger ellisonbg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.