QuantumKatas icon indicating copy to clipboard operation
QuantumKatas copied to clipboard

Disable cell id generation while working on jupyter notebooks locally

Open Manvi-Agrawal opened this issue 3 years ago • 0 comments
trafficstars

Issue context

While working on some notebooks like QFT workbook with jupyter locally, it generates cell ids to all type of cells(code, markdown, etc). This is on not a problem if someone is running a kata locally. However, its extremely frustrating for people who want to contribute to Quantum Katas repo. As a mitigation, we might want to use "git add -patch" or edit the JSON object directly in VSCode for extremely small changes. But it does not scale well if someone wants to add a section/tasks to the notebooks

Issue discovery

I recently moved to a new device and noticed the generation of "id" field for QFT workbook when I raised PR #819 . To avoid the noise in my PR, I opened the workbook with VSCode in json format and edited the json directly instead of doing it from jupyter locally. Later, I discovered that this issue was not happening in QFT kata. So, I investigated further on this and found that nbformat minor versions are different(4.2 in QFT kata, 4.5 in QFT workbook)

Problem reason

Nbformat version 4.5 introduced a new field cell id to be added to all type of cells(code, markdown, etc).

Cell Id addition to jupyter notebooks JEP: https://jupyter.org/enhancement-proposals/62-cell-id/cell-id.html Nbformat doc : https://nbformat.readthedocs.io/en/latest/format_description.html#cell-ids

Potential Fix

Downgrade nbformat version to 4.2/4.4

Issue Scope

A quick search in VSCode for "nbformat_minor": 5 reveals that the following jupyter notebooks which are on nbformat version 4.5

  • Basic Gates workbook
  • QFT Workbook
  • MultiQubitSystemsMeasurement workbook
  • RandomNumberGeneration tutorial workbook

Manvi-Agrawal avatar Aug 10 '22 17:08 Manvi-Agrawal