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

Export nbdiff-web HTML from command line #468

Open
david-macleod opened this issue Apr 11, 2019 · 10 comments
Open

Export nbdiff-web HTML from command line #468

david-macleod opened this issue Apr 11, 2019 · 10 comments

Comments

@david-macleod
Copy link

Is it possible to export the HTML difference generated by the in-notebook "Export" button directly from the command line (without having to manually interact with the application GUI). If not, would this be difficult to implement as a feature?

The use case is:

  1. A large number of notebooks containing plots need to be re-run after a change to the underlying source code is made, and diffs calculated
  2. The notebooks which have changed are then inspected visually

If we have a static HTML view of the difference we can automate the process of filtering the notebooks which have not changes. Additionally, having a fixed copy of the HTML difference for future reference is useful it itself.

Thank you

@david-macleod david-macleod changed the title Export nbdiff-web html from command line Export nbdiff-web HTML from command line Apr 11, 2019
@james-nesbitt
Copy link

This would also make the diff more usable in various CI scenarios

@vidartf
Copy link
Collaborator

vidartf commented Apr 30, 2019

Sorry, I could swear I wrote an answer to this. It must have gotten lost somewhere..

The current export button was added as a minimal implementation to get this functionality. What you are asking is not currently possible, but should be possible to build. However, it would require one of these two dependencies:

  • Either a headless browser to run the JS for generating the HTML DOM from the diff.
  • Or node.js with jsdom package for the same purpose.

Another alternative is to save the diff as a self-contained, dynamic HTML page, i.e.

  • The HTML template rendered out, with the diff in JSON format in the page.
  • The nbdime JS to convert the diff to DOM (either embedded in the doc, or as a side-by-side .js file).

The final alternative is to rewrite the diff to DOM logic in Python. This is not something that I will do at least, but I'd welcome any PRs, given they come with a commitment to help maintain the code.

I'm good with either of the first two alternatives. Given enough time, I guess both could be implemented, with a flag to choose between them.

Thoughts on the alternatives? (CC @minrk)

@minrk
Copy link
Member

minrk commented May 13, 2019

The second option is probably the simplest to implement and maintain, if not the nicest in principle. Given our current circumstances, I'd probably go with that.

@RuinedSubmartingale
Copy link

RuinedSubmartingale commented May 12, 2020

@vidartf or @minrk , any update on this issue? My team would greatly benefit from this added functionality.

@vidartf
Copy link
Collaborator

vidartf commented May 13, 2020

@Synergist I'm not in a position where I can spend the time on this myself in the near future, but I would be happy to help anyone who would be willing to take this on!

@leosunmo
Copy link

leosunmo commented Jun 1, 2020

This would be hugely useful for me as well, unfortunately I am not familiar enough with Python or Jupyter projects to help.

My use case is to run this tool in a CI pipeline as well. It's very difficult to use currently as it requires us to spin up a lot of nbdime docker containers to display diffs.

@trams
Copy link

trams commented Nov 18, 2020

Is there any progress on this?
If not I will be interested in contributing to this. If someone is willing to pair/review I would appreciate

@vidartf
Copy link
Collaborator

vidartf commented Nov 18, 2020

I'm willing to help with review, and helping out along the way 👍

@trams
Copy link

trams commented Nov 22, 2020

#552 should solve this

@vidartf I would appreciate your code review and your feedback

@cjerdonek
Copy link

Hi, I just posted a minimal PR that would let people address this issue without having to fork or patch nbdime's source code (or even change the default template): #744
In my PR description, I included a link to a gist showing an example of how this can be done with the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants