-
Notifications
You must be signed in to change notification settings - Fork 391
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
Jupyter extension for Jupytext #86
Comments
Maybe this interface could be used to temporaralily turn on and off the jupytext (when someone want to see .py file as textfile, so the user doesnt need to edit notebook configuration file by hand - but this I is maybe another, more complicated problem) |
@danieltomasz , I've not find yet how to get started on the extension. Still I have a quick tip relative to your question: if you want to open |
@mwouts if you want we can do a pair programming session on this one. I have quite some experience working with Javascript. Let me know on Twitter if you are interested https://twitter.com/Wetschoreck |
@FlorianWetschoreck , I've been thinking about what would be a good start for the extension. Here is what I found - this is just a draft, if you think otherwise please let me know!
How do you see the interface? I was thinking of a dialog with two tabs (global and local config). Also, do you think that we can offer an implementation that works for both Jupyter notebook and Jupyter Lab? |
@mwouts , sounds good so far. For the view of the current notebook configuration:
We can discuss any open details during our hangouts session :) |
Yesterday we reviewed together the Jupyter Lab extension tutorial. The tutorial seems to works very well. The next step will be to find how to access to either the notebook metadata, or to Jupyter's configuration itself, and to write a dialog with the configuration options. Florian mentioned that a good reference on buttons, drop-downs, etc is bootstrap. |
Here are some hints about how to edit notebook metadata. Also, we can get inspiration from all the official JupyterLab extensions: Also, some inspiration about how to test the extension as we talked about in the call: |
Thanks Florian. On my side, no real progress yet (I've been working on a few other issues), but... the more I look at the toc2 extension, the more I like it! The extension is for jupyter notebook (but that would be a good start already). The code is not very long, and shows examples of
|
Sounds good :) |
@FlorianWetschoreck , I have a very basic extension... The code is in the jupyter_notebook_extension branch, and it does the following:
Do you think you could add a few controls to the dialog ? To begin with, I would like to map the 'formats' metadata to the following choices
Thanks! |
@mwouts great start. I will have a look at it on the weekend. Is that correct? |
Thanks @FlorianWetschoreck . Well, for me the difficult part is how to add the button... I think I see already how to edit the notebook metadata, so you should not bother with that part. If you can just show me how to add one dropdown to the dialog, and how to print the selected value in the console log, then that would be great already! |
Thanks @FlorianWetschoreck . I have added a few more buttons and checkboxes in the dialog. The next step will be to actually connect the buttons to the notebook metadata itself. Would you like to start with the comment magics flag ? Ideally, I'd like to see how you
Also, I have noticed that it is more convenient to work directly on the local js file (i.e refresh does reload the updated extension). The exact location of the local file is returned by notebook.nbextensions.install_nbextension('jupytext.js', user=True). Or, if you prefer to keep both files in sync, you could even install Jupyter's copy as a symlink... |
Yes, I think it's exactly what I wanted. Thank you Florian! I will work a bit more on the mapping of the other controls, possibly also review the interface. When I get something good enough to be tested I will share it here. Thanks again! |
Great, I am happy to help, Marc. |
@FlorianWetschoreck , @fwouts , I could finally write an extension for Jupyter Notebook: https://github.com/mwouts/jupytext_nbextension. And I hope to soon be able to publish another extension for JupyterLab... The extension adds a Jupytext menu to Jupyter Notebook. It was simpler to start that way than to offer a UI with options. It's very simple, but I believe it is still useful. There are two small changes I'd like to make: change the location of the menu, and check the selected menu entry. I will open two issues for that at https://github.com/mwouts/jupytext_nbextension, please help if you can! |
I have also started working on a JupyterLab extension at https://github.com/mwouts/jupyterlab-jupytext. Unlike the Jupyter Notebook extension, that one is not functional, because I have no idea on how to access the notebook metadata from the commands. Please share you know-how at mwouts/jupyterlab-jupytext#1! Thanks |
Hi everyone, I'm happy to let you know that
Both require the latest rc (now 1.0.0-rc3):
Feedback is welcome. Also, before I let the 1.0.0 version go I'll try to bind the extensions with the python package, as |
I know so little about typescript... Can anyone tell me how to read the content of I'm asking as even |
@mwouts Sorry for the delay! It looks like What this is saying is basically: "this could be anything" (it's effectively untyped). In this specific case, I think the You could do the following:
Or if you want to catch any unexpected values, a more verbose approach:
|
Thanks François, that's very helpful! That should be enough to get me back on the road again... |
Now the jupyterlab extension has a check sign on the selected format. That's great, thanks @fwouts ! I think we are now facing the last issue before the first release of the JupyterLab extension: how can I avoid deleting the full jupytext section when setting format='none'? Because of the current definition of |
There are two things happening here:
There are a few different ways to check that an object is empty:
|
The two extensions are available at pip install jupytext==1.0.0rc4 They are not yet installed automatically (issue #176). However, the manual installation process is easy and documented here. Thanks @fwouts , @FlorianWetschoreck and @hikenace for your contributions and great support ! |
An extension for Jupyter would make the configuration of paired notebooks easier. Rather than asking to edit the
jupytext_formats
metadata, we should offer the user an interface where the user can select the desired notebook extensions (among ipynb, py, jl, R, md, Rmd; the order matters), and the format for each extension (default, light, percent, sphinx...).The documentation on how to distribute a notebook extension is here. Extensions have to be written in Javascript, which I have almost never practiced before - help is welcome!
Useful references are:
The text was updated successfully, but these errors were encountered: