-
Notifications
You must be signed in to change notification settings - Fork 96
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
Prevent committing notebooks with errors in cell outputs #180
Comments
I would assume errors have some sort of metadata annotation. Do you have an example notebook with an error? |
Here's one (zipped since GH doesn't allow uploading [][0] |
This is the noteobook's relevant JSON: {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "IndexError",
"evalue": "list index out of range",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn [1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m [][\u001b[39m0\u001b[39;49m]\n",
"\u001b[0;31mIndexError\u001b[0m: list index out of range"
]
}
],
"source": [
"[][0]"
]
}
]
} |
So maybe the trigger could be any(out["ename"].endswith("Error") for out in outputs) |
An |
I won't be able to work on implementing this. Contributions welcome! |
@janosh Are you still interested in this? Would you be happy to work on it? |
Is it possible to detect whether a cell output is an error + stack trace and let users specify one of 3 options
ignore
,strip
orerror
? The first would be current behavior of doing nothing, second would remove the cell output and third would exitnbstripout
non-zero so that using it as apre-commit
hook aborts commits.My goal is to prevent accidentally releasing notebooks like this:
The text was updated successfully, but these errors were encountered: