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

Add ability to render diffs between published versions #58

Open
MSeal opened this issue Feb 6, 2019 · 6 comments
Open

Add ability to render diffs between published versions #58

MSeal opened this issue Feb 6, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@MSeal
Copy link
Member

MSeal commented Feb 6, 2019

Using the python dict diff from nbdimes we'd like to have a component based UI to render the diff between two notebook versions. There could be more use cases past this, but as a most basic step this would add a lot of utility.

https://github.com/jupyter/nbdime/blob/master/nbdime/diffing/notebooks.py#L605-L612

@MSeal
Copy link
Member Author

MSeal commented Feb 6, 2019

format schema is found at https://github.com/jupyter/nbdime/blob/master/nbdime/diff_format.schema.json

In [9]: orig = nbformat.read("binder/process_highlight_dates.ipynb", as_version=4)                                                                                                                 

In [10]: new = nbformat.read("binder/process_highlight_dates_new.ipynb", as_version=4)                                                                                                             

In [11]: diff_notebooks(orig, new)                                                                                                                                                                 
Out[11]: 
[{'op': 'patch',
  'key': 'cells',
  'diff': [{'op': 'patch',
    'key': 3,
    'diff': [{'op': 'replace', 'key': 'execution_count', 'value': 1},
     {'op': 'patch',
      'key': 'outputs',
      'diff': [{'op': 'addrange',
        'key': 0,
        'valuelist': [{'name': 'stderr',
          'output_type': 'stream',
          'text': 'Input Notebook:  highlight_dates.ipynb\nOutput Notebook: ./highlight_dates_run_cli.ipynb\n'}]}]},
     {'op': 'patch',
      'key': 'source',
      'diff': [{'op': 'patch',
        'key': 1,
        'diff': [{'op': 'addrange',
          'key': 65,
          'valuelist': '-prepare-only -'}]}]}]}]},
 {'op': 'patch',
  'key': 'metadata',
  'diff': [{'op': 'patch',
    'key': 'language_info',
    'diff': [{'op': 'patch',
      'key': 'version',
      'diff': [{'op': 'patch',
        'key': 0,
        'diff': [{'op': 'addrange', 'key': 4, 'valuelist': '3'},
         {'op': 'removerange', 'key': 4, 'length': 1}]}]}]}]}]

@jaipreet-s
Copy link
Member

Idea:
Sub component for each type of op. During rendering, iterate through the response and render each sub-component

@rgbkrk
Copy link
Member

rgbkrk commented Feb 6, 2019

This makes me wonder if we could support this through an endpoint to compare between versions from two notebooks on S3, with exactly the code you provided.

@MSeal MSeal added the enhancement New feature or request label Feb 9, 2019
@leosunmo
Copy link

Is anyone looking in to this? I have been trying to produce automatic diffs for CI pipelines using nbdime, but it's built as a one-off cli tool, not a persistent web server that can take two notebooks and render the diff. Any progress in this area would be fantastic!

@MSeal
Copy link
Member Author

MSeal commented Aug 27, 2020

There's not anyone taking on improving the diffing story in the open source atm that I'm aware of. jupyter/nbdime#468 would enable an easy way to generate the diffs for CI tooling purposes. Current maintainers of nteract projects are focused on some other projects atm, so we'd love more contributors to take on these issues but we're not planning on tackling this feature in the near future afaik.

@leosunmo
Copy link

Thanks for the quick reply @MSeal ! I am aware of the nbdime issue, but not much action there either, and no plans. Oh well! Thanks for your hard work!

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

No branches or pull requests

4 participants