-
Notifications
You must be signed in to change notification settings - Fork 152
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
How to read notebooks from python scripts? #128
Comments
I forgot to mention that the question is related to jupyter/notebook#3694 (originally on how to read notebooks from R markdown, but reading from python might be very useful as well). |
After notebook format version 3, we dropped the notion of saving notebooks in different kinds of file using nbformat, and made JSON the only supported format. Now if people want to plug in a different way to store notebooks, they usually do that at the 'content manager' level in the notebook server. If you want to write your own code to read another kind of file, it's very easy to use nbformat to construct a notebook object: http://nbformat.readthedocs.io/en/latest/api.html#module-nbformat.v4 |
Hi @takluyver , yes certainly, that's what we have been doing (providing a contents manager) in the nbrmd / nbsrc projects, and it works quite well indeed. My question was more about your previous experience on how to design a good representation of notebooks as python scripts, how to make sure that generic python files open well in jupyter, and that round trip convertion preserves inputs, etc., but I see that By the way, the documentation you cite seems to answer another question I had - whether there is a standard cell metadata for hidding cell input/ output (jupyter/notebook#3700). Apparently |
Thanks @takluyver for the updates. Since then, I have developed jupytext that reads/writes python scripts from Jupyter notebooks, so I'll close this issue. The tool has started working fairly well, but in case you have one instant for this, any feedback on the file format is warmly welcome! |
I know I can save notebooks as python scripts using
nbformat.v3.nbpy
, and that I can open them again as python notebooks.I'd like to go further, and open arbitrary python scripts as notebooks. Recently I've been working on a proof of concept at nbsrc. The main difficulty in doing that seems to define a natural and robust format for notebooks as python scripts. Current format is documented here.
Could you please share your experience on this? I'd be glad to have your feedback on the text format drafted in previous link. Also, I was wondering why
nbpy
had not been ported to v4. Thanks!The text was updated successfully, but these errors were encountered: