Using Notebook Publish Check: keep figures and review logs before publication
Table of contents of this article
- Keep the figure and select only the log cell
- Step 1: Check Python
- Step 2: Download the sample and enter its folder
- Step 3: Create an environment and install with pip
- Step 4: Generate a report from the sample
- Step 5: Open the HTML and check the result
- Step 6: Check the exported copy again
- Troubleshooting and trying your own data
- Using Windows or Linux
- Capabilities and limits
- Follow the source and updates
When sharing a notebook, you may want to keep figures but remove long logs. Notebook Publish Check helps prepare a separate copy while reviewing cell-level findings and output. It does not modify the original or execute code.
Keep the figure and select only the log cell
In cell 3 of the live demo, select Remove all outputs and execution count from this cell. Leave cell 2 unselected, then click Download selected copy (.ipynb) at the top. The image is a tiny synthetic display sample, and the credential-like log strings are fake.
The hosted demo is a report built from synthetic data, not an interface for uploading your files.
Step 1: Check Python
The steps below run the synthetic sample in macOS Terminal. You need Python 3.10 or later and an internet connection. Start with this command.
python3 --version
If a version such as Python 3.14.0 appears and it is at least 3.10, continue. If Python is missing or older, install a supported version from the official Python website and reopen Terminal. The exact version varies by environment.
Step 2: Download the sample and enter its folder
Download the ZIP below and double-click it in Finder’s Downloads folder to extract it. pip installs the command; the ZIP supplies the practice files.
With the default download location and extracted folder name, run the following. If you saved it elsewhere, replace the path with that folder.
cd ~/Downloads/notebook-publish-check-main
No output means the directory change succeeded. Next, check that the input files are present.
ls examples
You are ready when the list includes publication-demo.ipynb. If you see “No such file or directory”, check the extraction location and folder name, then repeat this step.
Step 3: Create an environment and install with pip
Create a virtual environment in the folder you just entered.
python3 -m venv .venv
If the prompt returns without output, creation succeeded. Now activate the environment.
source .venv/bin/activate
The prompt usually starts with (.venv). Keep this Terminal open and run the next command.
python -m pip install notebook-publish-check==0.1.0
The first install prints “Successfully installed”. These steps pin version 0.1.0, which was used for verification. Confirm that the next command displays usage information.
nbpublish --help
The blocks below contain commands to enter. Do not paste explanatory text or output into the terminal.
Step 4: Generate a report from the sample
Run the following once in the same Terminal. Copy the entire command as one line.
nbpublish examples/publication-demo.ipynb --output reports/review.html --json reports/findings.json
The synthetic sample produces seven findings and exit code 1. That means there are items to review, not that report generation failed. Open reports/review.html, select unwanted outputs and save a separate copy.
This is an excerpt of the output, not a command to enter.
7 findings. Private local report: reports/review.html. Original unchanged.
Step 5: Open the HTML and check the result
On macOS, this command opens the generated HTML in your default browser. You can also double-click the file in Finder.
open reports/review.html
The screenshots below were captured while operating the public demo in Chrome using the same synthetic sample as this tutorial. Click an image to view it at full size.
1. First check “4 cells · 7 findings” on the right. “0 cells: outputs removed” means no cell output has been selected for removal yet.
Next, keep the figure and remove only the log. Follow 2 and 3 below to save a separate file named reviewed-copy.ipynb.
2. Scroll to Cell 3 and select the checkbox shown. Leave Cell 2 unchecked. The log preview disappears for Cell 3, but the original file is not modified.
3. Return to the top, check “1 cells: outputs removed”, and press the green button. The 7 findings above describe the original notebook. Recheck the saved copy in Step 6 to get its finding count.
Step 6: Check the exported copy again
If the browser saved the file to Downloads without renaming it, run the following. Otherwise replace the input path with the actual location and name.
nbpublish ~/Downloads/reviewed-copy.ipynb --output reports/rechecked.html --json reports/rechecked.json
This sample also contains a fake credential-like string in its source code, so removing outputs does not clear all findings. Open reports/rechecked.html and confirm that cell 2 keeps its image, cell 3 has no log, and inspect the remaining findings. The original examples/publication-demo.ipynb is unchanged.
open reports/rechecked.html
Troubleshooting and trying your own data
For “command not found”, return to the Step 2 folder and activate the Step 3 environment. For missing input files, check the Step 2 listing again. If output files already exist, use new output filenames before rerunning.
For your own data, replace the input paths in Step 4. Read the README’s input format and constraints first, and work with copies. The basic tutorial ends after rechecking the exported copy in Step 6.
Using Windows or Linux
The commands above were verified on macOS. On Windows use py -3 to launch Python and dir to list files. After entering your actual download folder, use the PowerShell activation command below. If an organizational execution policy blocks it, consult your administrator without changing that policy.
py -3 -m venv .venv
.venv\Scripts\Activate.ps1
pip and tool commands are the same. Open the HTML using File Explorer. On Linux use the macOS commands above, replacing open with xdg-open, or use your file manager. These steps have not been tested on Windows or Linux.
Capabilities and limits
The review HTML contains the original notebook. Do not publish reports generated from your own files without review. Removing outputs leaves source code and attachments intact. Check the saved copy again and edit source code if needed.
Checks use selected credential patterns, absolute paths and output size. They do not guarantee detection of all secrets or personal information and do not OCR images. Supported input is nbformat 4, up to 20 MB.
The counts and outputs in this article are based on Codex verification with synthetic samples. They do not establish effectiveness on real data or validation by real users.


