jupyter / nbformat

Reference implementation of the Jupyter Notebook format
http://nbformat.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
259 stars 153 forks source link

Cell "executing" state #365

Open davidbrochart opened 1 year ago

davidbrochart commented 1 year ago

Currently, the execution_count field of a code cell can be None or an integer greater than 0, the former meaning that the cell was not executed, and the latter meaning that the cell was executed. But there is no way to denote that the cell is being executed, although the notebook could be saved while in that state (for instance when a cell takes time to execute). Actually, since outputs can be generated while the cell is executing, if the notebook is saved during that time, the cell will have outputs but it will appear as "not executed", which seems contradictory. At the same time, frontends such as JupyterLab show this information with a * in the execution_count. I think it would make sense to allow this value to be stored in the execution_count field of a code cell. See https://github.com/jupyter-server/jupyter_ydoc/issues/169 for a motivation about using this in the context of RTC.

westurner commented 1 year ago
# instead of
execution_count:Union[int,str]='*'

# PERF: just an [signed?] int field would be faster
execution_count:int=-1

What are other possible uses for negative numbers in the execution_count field?:

On Thu, Jun 15, 2023, 4:14 PM David Brochart @.***> wrote:

Currently, the execution_count field of a code cell can be None or an integer greater than 0, the former meaning that the cell was not executed, and the latter meaning that the cell was executed. But there is no way to denote that the cell is being executed, although the notebook could be saved while in that state (for instance when a cell takes time to execute). Actually, since outputs can be generated while the cell is executing, if the notebook is saved during that time, the cell will have outputs but it will appear as "not executed", which seems contradictory. At the same time, frontends such as JupyterLab show this information with a * in the execution_count. I think it would make sense to allow this value to be stored in the execution_count field of a code cell. See jupyter-server/jupyter_ydoc#169 https://github.com/jupyter-server/jupyter_ydoc/issues/169 for a motivation about using this in the context of RTC.

— Reply to this email directly, view it on GitHub https://github.com/jupyter/nbformat/issues/365, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMNSZQF2ZLK2SYPLFIAFDXLNUL3ANCNFSM6AAAAAAZIK733M . You are receiving this because you are subscribed to this thread.Message ID: @.***>