You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently ipython notebook saves new notebooks as "untitled #.ipynb" where # is a sequence number. That's nice because it safes you the hassle of thinking of saving in the first place. It is however not so nice because in a short amount of time you end up with a list of "untitled #.ipynb" files and it becomes hard to find a specific notebook, short of opening (and shutting down) each one. Of course, not renaming the notebook before closing it down is simply a sign of one being too lazy or forgetful, then again, it would be nice if ipython took the hassle out of this, too.
I suggest to improve naming with either of the following:
intelligent auto naming: take the first comment line of a code cell, the first literal name, or the first line of text in any other cell
on user's first explicit save (Ctrl-S), ask for a name
on closing the notebook, ask for a name
As one way to implement this, e.g. ipython_notebook_config.AUTOSAVE_NAMING could take a lambda that would receive the first cell's type and context and returns a name, so users can simply override it. The default implementation would do as shown below.
Consider these examples
# fun with fibonacci
def fib(n):
....
=> would be saved to 'fun with fibonacci.ipynb'
def numbers(N):
for n in N:
yield N
=> would be saved to numbers.ipynb
[markdown cell]
* great stuff
* and it has intelligent autonaming, too
=> would be saved to great stuff.ipynb
The text was updated successfully, but these errors were encountered:
This is a bit tricky, because the name is actually picked when you create a notebook, and used in the URL, so I'm not sure that we should be changing that automatically on save.
If we did do something like this, I think it would be reasonable to look for a title in the first markdown cell. Doing it from function names, comments etc. feels a bit too clever (and hard to do in a cross-language way).
This is a bit tricky, because the name is actually picked when you create a notebook, and used in the URL
I see, however the user can choose to rename at any time, so we could just simulate a rename. And since he didn't pick the generated name in first place he will not mind if ipython does that automatically once it knows better (i.e. some content has been entered).
I think it would be reasonable to look for a title in the first markdown cell
I guess that would be a fair start. I'm not sure how this applies to most users, however most of my notebooks are for dev work and don't have a markdown cell. they generally all have a comment line at the top though...
anyhow, I considered it would be difficult to get this right in general/multiple languages, hence the idea for the lambda/callable in ipython_notebook_config.AUTOSAVE_NAMING, so it would be easy to adjust for one's own style. Or whatever better approach you see fit to achieve the same...
Currently ipython notebook saves new notebooks as "untitled #.ipynb" where # is a sequence number. That's nice because it safes you the hassle of thinking of saving in the first place. It is however not so nice because in a short amount of time you end up with a list of "untitled #.ipynb" files and it becomes hard to find a specific notebook, short of opening (and shutting down) each one. Of course, not renaming the notebook before closing it down is simply a sign of one being too lazy or forgetful, then again, it would be nice if ipython took the hassle out of this, too.
I suggest to improve naming with either of the following:
As one way to implement this, e.g.
ipython_notebook_config.AUTOSAVE_NAMING
could take a lambda that would receive the first cell's type and context and returns a name, so users can simply override it. The default implementation would do as shown below.Consider these examples
=> would be saved to 'fun with fibonacci.ipynb'
=> would be saved to numbers.ipynb
=> would be saved to great stuff.ipynb
The text was updated successfully, but these errors were encountered: