-
Notifications
You must be signed in to change notification settings - Fork 160
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
Use nbdiff in JupyterLab extension #534
Comments
Note that the actual diff processing of nbdime is running on the server. You can send it the files for processing using the (unfortunately undocumented) REST APIs: https://github.com/jupyter/nbdime/blob/master/nbdime/webapp/nb_server_extension.py Ideally the nbdime labextension would be something you could require and call into, but for now that hasn't been built out yet. If you are willing to help with that I'm sure it is something we could do. |
Also: How would you want to consume the diff? Do you want a rendered diff view, or do you want the diff as expressed by the JSON diff format? |
I noticed on the REST API in the documentation have included a call to For some context: my extension essentially pulls changes from a remote git repository, merges the version in JupyterLab (that the user is working on) and the pulled version comparing it to a base version. If the files can merge without conflicts, the code editor should automatically be updated with the merged version of the file. If not, the diff viewer should pop up. I'm not quite sure what the best way to do this is, as this is my first JupyterLab extension. It seems that maybe requiring the nbdime labextension would be easier, but I'm not quite sure how to do that (if you have any pointers that would be great). Thank you! |
@ashleyswang the jupyterlab-git extension uses nbdime to display diffs so that may be helpful starting place, although it does not do exactly what you described. The Diff code lives here: https://github.com/jupyterlab/jupyterlab-git/tree/master/src/components/diff. jlab-git uses Git in a subprocess to generate the actual diff and then feeds that to the nbdime web frontend. Maybe you could do something similar to the jlab-git rest api that just results in a call to nbdime-merge. Also, if you're interested, contributing something like what you described to jupyterlab-git would be awesome. There's an open issue on exactly this jupyterlab/jupyterlab-git#301 as well as one for the ability to merge branches: jupyterlab/jupyterlab-git#310 p.s. jupyterlab-git was the first extension I contributed to, and I found that doing so helped me learn a lot about how to make labextensions. |
I am trying to use nbdiff as a part of another extension I am writing for JupyterLab, but I can't find enough documentation to figure out how to do so. Is this possible to do with nbdime?
To be clear I would like to be able to do something like this in a src file for the extension:
Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: