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

Feature Request: Notebook to script #3732

Closed
betteridiot opened this issue Jan 26, 2018 · 6 comments · Fixed by #5571
Closed

Feature Request: Notebook to script #3732

betteridiot opened this issue Jan 26, 2018 · 6 comments · Fixed by #5571
Labels
enhancement help wanted pkg:notebook status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@betteridiot
Copy link

Small quality of life feature request. We can already drag & drop from one notebook to another notebook. However, it would be awesome if you could drag a cell from a notebook into the text editor and have it populate that cell's script into the editor. Don't know if this is possible, but I like to think of my notebook as a checklist of sorts. When a function for a module is done being prototyped, I like getting it out of my sight so to speak.

@carlthome
Copy link

I like this, but if you only do this for a single cell the created module will typically not work as there are globals in the notebook (set by previous cell runs).

There should preferably be some smartness added to either warn if the cell relies on other cells somehow, and maybe required imports, top-level objects, and the like could even be automatically added to the export.

@blink1073 blink1073 added this to the 1.0 milestone Feb 1, 2018
@holdenweb
Copy link

I imagine a naive implementation that simply treated the cell contents as text would be good enough for 80% of purposes, and it would certainly avoid a LOT of complex analysis that would be required to add the "smartness," which could be provided by a later enhancement if necessary. Cross-process drag and drop seems like a pretty complicated and platform-dependent feature, TBH.

@ian-r-rose
Copy link
Member

I agree with @holdenweb that actually populating the session with imports, variables, etc would be prohibitively complex (especially since we support order 100 kernels). That being said, I think that drag-drop for cell contents into a text editor would be very doable (perhaps for an advanced beginner).

@spapini
Copy link

spapini commented Jul 5, 2018

What about https://github.com/jupyter/nbconvert ?
It support converting notebooks to scripts.
We can probably use it to add something like "export to script"

@holdenweb
Copy link

What would that do that "File | Download as | Python" wouldn't?

@spapini
Copy link

spapini commented Jul 5, 2018

Wait, it already exists, you are right. My bad. (File -> export as -> executable script)

@jasongrout jasongrout removed this from the 1.0 milestone Sep 5, 2018
@blink1073 blink1073 added this to the Future milestone Sep 11, 2018
@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Aug 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement help wanted pkg:notebook status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants