Skip to content

Populate notebook metadata when exporting with %notebook magic#14955

Merged
krassowski merged 2 commits intoipython:mainfrom
krassowski:notebook-metadata
Aug 8, 2025
Merged

Populate notebook metadata when exporting with %notebook magic#14955
krassowski merged 2 commits intoipython:mainfrom
krassowski:notebook-metadata

Conversation

@krassowski
Copy link
Member

Fixes #14954

@krassowski krassowski added this to the 9.5 milestone Aug 7, 2025
@krassowski krassowski requested a review from Copilot August 7, 2025 12:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds metadata population to the %notebook magic command when exporting notebooks to fix issue #14954. The change ensures that exported notebooks include proper kernel and language information.

  • Populates notebook metadata with kernelspec and language_info when using %notebook magic
  • Adds test validation to verify the exported metadata contains correct Python version and kernel information

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
IPython/core/magics/basic.py Adds metadata dictionary with kernelspec and language_info to v4.new_notebook() call
tests/test_magic.py Adds test assertions to validate the exported notebook metadata contains expected values

@krassowski
Copy link
Member Author

CC @Darshan808 for review :)

@Darshan808
Copy link
Collaborator

This looks good. Thanks!

@krassowski krassowski merged commit cbac235 into ipython:main Aug 8, 2025
18 checks passed
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.

%notebook should populate notebook metadata with language and kernel information

2 participants