Hi all,
I’ve released notebookproof 0.2.1, a small Python package (MIT) for checking a notebook before you share it or report a number from it. You run it from a cell in the notebook you already have open.
There are two main checks.
notebookproof.check(“your-notebook.ipynb”) reads the saved .ipynb without executing anything. It reports likely missing or forward references, syntax errors, saved execution errors, missing or out-of-order execution counts, possibly stale outputs, star imports, notebook commands (magics), and some random calls with no visible earlier seed. It also lists what each cell reads and writes. Cell numbers include Markdown cells so they match the document order.
notebookproof.frame(df) checks a pandas or Polars DataFrame: missing values, mixed value types, repeated rows, duplicates or missing values in a key you declare, constant columns, numeric outliers, infinite values, identical columns and strong correlations. It checks all rows by default and does not modify the frame.
Small example (screenshot attached): a revenue notebook where cell 4 uses eur_to_usd, which is assigned in cell 5, so it only worked because the cells were run out of order. check() reports the out-of-order counts and the forward reference. Then frame(orders, keys=[“order_id”]) reports one repeated row and one repeated order_id.
Install:
%pip install notebookproof
There is also an optional notebookproof.verify(path) (install notebookproof[verify]) that runs the saved code in a separate fresh kernel with NBClient and reports the first failing cell. It doesn’t write the notebook or restart your current kernel, and it doesn’t compare old and new outputs. It runs the code with your normal permissions, so it’s not a sandbox.
Some limits I want to be upfront about: check() is static, so it doesn’t follow control flow, track mutations, or look at live kernel state, and magics or dynamic imports may need a manual look. check() with no path tries to find the current notebook, but that depends on the host. Passing an explicit path is the reliable option, including in VS Code.
Repo and quickstart notebook: GitHub - scottcampbelldata/notebookproof: Notebook preflight and DataFrame health checks inside Jupyter. Static checks do not execute your code. · GitHub
I’d especially like to hear about false alarms, and about how well finding the current notebook works in your setup (JupyterLab, Notebook 7, VS Code, Colab).
Thanks!
