-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
allow saving notebook.py next to notebook.ipynb #1146
Conversation
enable with: NotebookManager.save_script=True
with open(pypath,'w') as f: | ||
current.write(nb, f, u'py') | ||
except: | ||
raise web.HTTPError(400, u'Unexpected error while saving notebook as script') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should at least put the exception message here? I think it would both help users and us if we ever have to debug a user-side problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This is great; I only have one comment on the code I made inline. Otherwise, before merging I just think this feature deserves a little note in the notebook section of the docs, as it may not be noticed by users normally and can be very useful in many circumstances. If you're too swamped I can add that note before merging, let me know. |
doc note added |
Excellent, merging now. |
Allow saving notebook.py next to notebook.ipynb. This allows notebooks to be imported or %run via their .py companion file.
Allow saving notebook.py next to notebook.ipynb. This allows notebooks to be imported or %run via their .py companion file.
PR made at request of @fperez
This simply adds a flag for optionally saving .py version of notebooks alongside .ipynb.
enable with: