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
Using ipython notebook --script saves a copy of the IPython notebook as a python script with the metadata of the cells ( I feel so ) preserved as comments.
I suggest that there should be a way to convert back to ipython notebook given this python script.
Use cases :
Direct operations / Modifications to the python script could be done as a whole file and restored back to the notebook.
Certain tools like autopep8 operate only on a python script. Hence the .ipynb ---> .py --autopep8--> .py ----> .ipynb should become feasible once this feature is included.
Also I need a small clarification ... When downloaded as a python file ( using the File --> Download as ) the contents are different compared to the python script generated using ipython notebook --script. Why is that so ? Only the latter seems to preserve the metadata in a disambiguous manner. The former method does not ( the commented metadata could as well be a regular comment )
The text was updated successfully, but these errors were encountered:
Support for lossless roundtrip to .py files is not planned for support. In the next release, the --script flag is to be removed. The reason the output is different is also the reason --script is to be removed. --script was added when writing notebooks as Python was part of IPython.nbformat, and never actually wrote correct Python files. With the addition of nbconvert, this is no longer the case, and support for .py files is to be removed from IPython.nbformat. Download as uses nbconvert, which is the proper Python output of a notebook.
In the absence of --script, I do plan to add a more generic post-save hook, which could be used here.
@minrk is there a way to convert python .py script into notebook. I think this was the request in this issue. Round-tripping is not strictly necessary, but it would be nice feature anyway (running PEP8 checkers as suggested by @raghavrv being one use case and easy diffing/merging another),
Using
ipython notebook --script
saves a copy of the IPython notebook as a python script with the metadata of the cells ( I feel so ) preserved as comments.I suggest that there should be a way to convert back to ipython notebook given this python script.
Use cases :
autopep8
operate only on a python script. Hence the.ipynb ---> .py --autopep8--> .py ----> .ipynb
should become feasible once this feature is included.Also I need a small clarification ... When downloaded as a python file ( using the File --> Download as ) the contents are different compared to the python script generated using
ipython notebook --script
. Why is that so ? Only the latter seems to preserve the metadata in a disambiguous manner. The former method does not ( the commented metadata could as well be a regular comment )The text was updated successfully, but these errors were encountered: