Skip to content

Applying minor version upgrades to notebook #196

Closed

Description

I ran into this problem while trying to use #189.

Right now, upgrade doesn't actually apply minor version changes to the given notebook (ref: https://github.com/jupyter/nbformat/blob/master/nbformat/v4/convert.py#L67).

I was unable to find a method that could apply minor version updates on existing notebooks without downgrading first (ping @willingc who was on call trying to help me find a method.) writes and reads appear to concern themselves only with major versions, and upgrade_cell is specifically stated to only work with v3 cells and will break v4 cells if provided.

If there is no method to do minor version migrations, then my proposal would be that this block of code should look something like this:

if from_minor == nbformat_minor:
    return

# other versions migration code e.g.
# if from_minor < 3:
# if from_minor < 4:

if from_minor < 5:
    for cell in nb.cells:
        cell.id = random_cell_id()

nb.metadata.orig_nbformat_minor = from_minor
nb.nbformat_minor = nbformat_minor

By doing this, upgrade would be able to apply minor-version patches step-by-step for notebooks within the same major-version.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions