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

Generated jupyter notebook cell ids (required for jupyter notebook format 4.5+) #808

Merged
merged 3 commits into from
Oct 13, 2022

Conversation

marscher
Copy link
Collaborator

@marscher marscher commented Sep 29, 2022

Changes

Generated cell ids with nbformat.normalize

Related Issues

A workaround PR #806

Checks

  • update example/tutorial notebooks

Related tools

nbformat=5.7

script:

import json
from glob import glob

import nbformat
from nbformat.validator import normalize

nbs = glob("*.ipynb")
for n in nbs:
    with open(n) as fh:
        print(f"loading file {n}")
        nb_data = json.load(fh)
    n_changes, nb_norm = normalize(nb_data)
    if n_changes > 0:
        print(f"rewriting notebook {n}")
        NB = nbformat.from_dict(nb_norm)
        with open(n, 'w') as fh2:
            nbformat.write(NB, fh2, version=4)

@marscher marscher added documentation Improvements or additions to documentation no-changelog-entry-needed labels Sep 29, 2022
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions
Copy link

github-actions bot commented Sep 29, 2022

Test Results

2 185 tests  ±0   2 184 ✔️ ±0   3m 35s ⏱️ +59s
       1 suites ±0          1 💤 ±0 
       1 files   ±0          0 ±0 

Results for commit 64f2e13. ± Comparison against base commit d2b7684.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Sep 29, 2022

Codecov Report

Merging #808 (64f2e13) into master (d2b7684) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #808   +/-   ##
=======================================
  Coverage   96.80%   96.80%           
=======================================
  Files          81       81           
  Lines        5380     5380           
=======================================
  Hits         5208     5208           
  Misses        172      172           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@marscher
Copy link
Collaborator Author

xref: jupyter/nbformat#303

@marscher
Copy link
Collaborator Author

Omitting the major/minor versions for normalize/validate seems to work. Now we have a dependency problem (xarray) due to the environment caching.

@marscher marscher merged commit 3eb7d35 into BAMWelDX:master Oct 13, 2022
@marscher marscher deleted the nb_cell_ids branch October 13, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation no-changelog-entry-needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant