Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users should be able to clone a notebook #781

Closed
khinsen opened this issue Sep 12, 2011 · 9 comments
Closed

Users should be able to clone a notebook #781

khinsen opened this issue Sep 12, 2011 · 9 comments
Labels
Milestone

Comments

@khinsen
Copy link
Contributor

khinsen commented Sep 12, 2011

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

@ellisonbg
Copy link
Member

We should definitely support this. I will add it to my list of todos.

On Mon, Sep 12, 2011 at 6:40 AM, khinsen
reply@reply.github.com
wrote:

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

Reply to this email directly or view it on GitHub:
#781

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@fperez
Copy link
Member

fperez commented Sep 12, 2011

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

@aarchiba
Copy link

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.

@fperez
Copy link
Member

fperez commented Oct 14, 2011

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

@fperez
Copy link
Member

fperez commented Oct 19, 2011

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'
"""
]

@fperez
Copy link
Member

fperez commented Oct 19, 2011

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

c.InlineBackendConfig.figure_format = 'svg'

@aarchiba
Copy link

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

@fperez
Copy link
Member

fperez commented Oct 19, 2011

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

@ellisonbg
Copy link
Member

This is fixed in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants