Skip to content

Update notebook version metadata during normalize - #430

Open
Rg9906 wants to merge 1 commit into
jupyter:mainfrom
Rg9906:branch1
Open

Update notebook version metadata during normalize#430
Rg9906 wants to merge 1 commit into
jupyter:mainfrom
Rg9906:branch1

Conversation

@Rg9906

@Rg9906 Rg9906 commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Updates nbformat.validator.normalize() to synchronize notebook version metadata with the target version used during normalization.

Previously, normalizing a notebook to a newer schema version could introduce fields that are only valid in that version (for example, cell IDs introduced in notebook format 4.5) while leaving nbformat_minor unchanged. This could produce a notebook whose contents no longer matched the version declared in its metadata.

Changes

  • Update normalize() to set:
    • nbformat = version
    • nbformat_minor = version_minor
  • Add a regression test covering normalization from v4.0 to v4.5

Motivation

Addresses #328.

The issue discussion notes that when normalization upgrades a notebook to a newer schema version, the notebook metadata should also be updated to reflect the version used during normalization.

Testing

pytest

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

Successfully merging this pull request may close these issues.

1 participant