BAMWelDX / weldx

The welding data exchange format
https://www.bam.de/weldx
BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

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

Closed marscher closed 1 year ago

marscher commented 2 years ago

Changes

Generated cell ids with nbformat.normalize

Related Issues

A workaround PR #806

Checks

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)
review-notebook-app[bot] commented 2 years ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

github-actions[bot] commented 2 years ago

Test Results

2 185 tests  ±0   2 184 :heavy_check_mark: ±0   3m 35s :stopwatch: +59s        1 suites ±0          1 :zzz: ±0         1 files   ±0          0 :x: ±0 

Results for commit 64f2e13e. ± Comparison against base commit d2b7684d.

:recycle: This comment has been updated with latest results.

codecov[bot] commented 2 years ago

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 commented 2 years ago

xref: https://github.com/jupyter/nbformat/issues/303

marscher commented 1 year ago

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