-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codepod-exported ipynb not compliant to NBFormat 4.0 #411
Comments
Quoted from nbformat official doc,
I use the
The "pod id" in metadata is exactly for Codepod use, Colab will create and refer
It handles both
Good catch, the
It's for 2D->1D mapping,
Please check the discussion about the scope information embedding here.
Sure, let me send a patch later. |
My bad. I didn't notice that
But
I wonder whether the type info is returned by the Jupyter kernel. Deepnote and Colab both list the content to be displayed on stdout (especially those explicitly triggered via Python's Below is an example of "outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"1/1 [==============================] - 0s 282ms/step\n",
"(3, 2, 4)\n"
]
}
] This is an example error output (exported by Colab with even color code): "outputs": [
{
"output_type": "error",
"ename": "TypeError",
"evalue": "ignored",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-3-e9dd7567ea46>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfoo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m: foo() takes 1 positional argument but 2 were given"
]
}
]
I read the two approaches you proposed. |
I read the messaging protocols in Jupyter notebook {
'msg_id' : str, # typically UUID, must be unique per message
'session' : str, # typically UUID, should be unique per session
'username' : str,
# ISO 8601 timestamp for when the message is created
'date': str,
# All recognized message type strings are listed below.
'msg_type' : str,
# the message protocol version
'version' : '5.0',
} Then, all messages for executing code are exchanged on the IOPub channel The difference between
Additionally, I experimented with a Colab notebook. If you export it to ipynb, pay attention to the output types of the four cells. @lihebi do we store the message type, returned from Jupyter kernel, in Codepod's database? That will save @senwang86 a lot of effort when exporting and importing. |
The attachment of this issue is an ipynb exported from this Codepod repo. It has some format issues incompatible with NBFormat 4.0:
#/metadata
has no property calledname
id
is a mandatory field for each cell under#/cells
But it's missing for all cells exported.id
is not a field inmetadata
of a cell.output_type
isdisplay_data
. This is not right. There are four types:execute_result
,display_data
,error
(see below), andstream
.display_data
has no property calledexecute_count
butexecute_result
has. In many cases in the attached example ipynb, the output should besteam
? For example, this cellwhere the
outputs/output_type
should have beenerror
, anddata
is NOT an allowed field for an error. Required fields, expectoutput_type
are all missing. See specs here.5. What is the
geoScore
property for each cell?6. Why is a scope and the first pod under it mixed together? Like this:
json { "cell_type": "code", "execution_count": 0, "metadata": { "id": "yla4ktyffvgxenaivved", "geoScore": 0.0011 }, "source": [ "'''\n", "CodePod Scope structure: Another test scope\n", "'''\n", "def foo(x):\n", " return x * x\n" ], "outputs": [] },
The scope should have become one separate cell of
raw
or evenmarkdown
type. In Markdown, the header level (#
,##
,###
, ...) should be proportional to the scope level.7. And, can we beautify the JSON output?
The text was updated successfully, but these errors were encountered: