Skip to content

Conversation

Copy link

Copilot AI commented Sep 28, 2025

  • Explored repository structure and identified the problem
  • Installed nbformat and nbconvert dependencies
  • Reproduced the error with nbconvert failing on widget metadata
  • Analyzed that generated notebooks lack widget metadata structure
  • Identified that the fix needs to be in utils/generate_notebooks.py
  • Updated build_notebook() function to include proper widget metadata structure
  • Fixed existing problematic notebook course/ko/chapter1/section3.ipynb
  • Verified all notebooks now pass nbconvert validation
  • Tested that newly generated notebooks work correctly

Problem Fixed:
The issue was that notebook metadata was missing the required metadata.widgets["application/vnd.jupyter.widget-state+json"]["state"] structure that nbconvert expects. This caused nbconvert to fail with a KeyError when trying to render notebooks.

Changes Made:

  1. utils/generate_notebooks.py: Added proper widget metadata structure with empty state object to all generated notebooks
  2. course/ko/chapter1/section3.ipynb: Fixed existing notebook by wrapping widget entries under the required state key

Validation:

  • All existing notebooks now pass nbconvert HTML conversion
  • Newly generated notebooks include proper widget metadata structure
  • No functional changes to notebook content or behavior
Original prompt

Invalid Notebook
There was an error rendering your Notebook: the 'state' key is missing from 'metadata.widgets'. Add 'state' to each, or remove 'metadata.widgets'.
Using nbformat v5.10.4 and nbconvert v7.16.6


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: braintrue <89627517+braintrue@users.noreply.github.com>
@braintrue braintrue marked this pull request as ready for review September 28, 2025 08:40
@braintrue braintrue merged commit 114d378 into main Sep 28, 2025
Copilot AI requested a review from braintrue September 28, 2025 08:40
Copy link
Owner

@braintrue braintrue left a comment

Choose a reason for hiding this comment

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

Confirmed.

@braintrue braintrue deleted the copilot/fix-97de62fb-3eb2-4cba-8fa1-68dd73e9d6d2 branch September 28, 2025 12:55
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.

2 participants