Skip to main content

📓 NotebookTester

uv image

A fast, reliable, and parallel Jupyter notebook testing tool with caching support! Test your notebooks with confidence.

🌟 Features

  • 🚀 Parallel Execution: Test multiple notebooks simultaneously
  • ⏱️ Configurable Timeouts: Set custom timeouts for notebook execution
  • 💾 Smart Caching: Cache test results to avoid unnecessary re-runs
  • 🎯 Selective Testing: Only test modified notebooks
  • 📊 Detailed Logging: Comprehensive logs with test results and errors
  • 🛠️ CLI Support: Easy to use command-line interface

🔧 Installation

Choose your preferred package manager:

Using pip (slow legacy)

pip install notebooktester

Using uv (10-100x faster)

see uv docs for more info.

uv add notebooktester

🚀 Quick Start

Test a single notebook:

notebooktester path/to/your/notebook.ipynb

Test all notebooks in a directory:

notebooktester path/to/notebooks/directory

🎮 Command Line Options

notebooktester [OPTIONS] PATH

Options:

  • -t, --timeout SECONDS: Timeout in seconds for each notebook (default: 60). With --report, the minimum duration to show (default: 30)
  • -w, --workers NUMBER: Number of parallel workers (default: CPU count)
  • -c, --cache-dir PATH: Cache directory for test results (default: .notebookcache)
  • -v, --verbose: Enable verbose output
  • -f, --force: Ignore cache and force test execution
  • -r, --report: Show long-running notebooks from the cache instead of running tests
  • --version: Show the installed version and exit

📋 Example Usage

Basic usage:

notebooktester notebooks/

With custom timeout and workers:

notebooktester notebooks/ -t 120 -w 4

Force re-run all tests:

notebooktester notebooks/ --force

Find long-running notebooks from the cache (no re-run needed):

notebooktester --report

Same, but with a lower threshold:

notebooktester --report -t 20

🔍 Cache Behavior

NotebookTester maintains a cache of test results to optimize performance:

  • Only notebooks modified since their last test run are re-tested
  • If the notebook timed out, and the current timeout has not been increased, notebook is skipped
  • Cached results include success/failure status and error messages
  • Force flag (-f) bypasses the cache

🐢 Long-Running Notebook Report

Once you've run the tests at least once, --report reads straight from the cache to show which notebooks are the slowest — no re-execution required. This pairs well with param() (see below): use the report to find your slow notebooks, then wrap their expensive parameters in param() so they run fast under notebooktester while keeping their real values everywhere else.

notebooktester --report
notebooktester --report -t 20        # lower the threshold to 20s
notebooktester --report -c .my-cache # point at a different cache dir

Example output:

>>notebooktester --report -t 20

🐢 Long-running notebooks (> 20s)

Notebook                        Time   Timeout  Status
------------------------------------------------------
notebooks/slow_train.ipynb     55.2s       60s  ✅ PASSED
notebooks/medium.ipynb         33.7s       60s  ✅ PASSED
------------------------------------------------------
2 notebook(s), 88.9s combined

⚡ Reducing Notebook Runtime with param()

Wrap expensive values in param(full, test=...) so notebooks run with a cheap stand-in under notebooktester, while keeping the real value everywhere else (e.g. when run interactively):

from notebooktester import param

EPOCHS = param(100, test=2)
SEARCH_SIZE = param(10_000, test=50)

📊 Output

The tool provides:

  • Progress bar for test execution
  • Colored console output for test results
  • Detailed logs in the logs/ directory
  • Summary of passed and failed tests

Example output:

>>notebooktester notebooks/ -t 120 -w 4
Running tests with 4 workers
Starting notebook tests - found 10 notebooks
✅ PASSED - notebook1.ipynb: Success
❌ FAILED - notebook2.ipynb: Cell execution error
⏰ TIMEOUT - notebook3.ipynb: A cell timed out

Test Summary: 8 passed, 2 failed

🤝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests

👤 Author

Raoul Grouls

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notebooktester-0.3.2.tar.gz (92.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

notebooktester-0.3.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file notebooktester-0.3.2.tar.gz.

File metadata

  • Download URL: notebooktester-0.3.2.tar.gz
  • Upload date:
  • Size: 92.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for notebooktester-0.3.2.tar.gz
Algorithm Hash digest
SHA256 6ad7d96a759aa708362b020850f4796526cc70debf4dfbb12dc8ed4a44de99c6
MD5 1d4cf37331b7e9363d659cf822f363a4
BLAKE2b-256 f0d8acb23b549656fe47318a7eee396d7617d64a33c7f55bcf7981ee482beb59

See more details on using hashes here.

File details

Details for the file notebooktester-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: notebooktester-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for notebooktester-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b983b8483c82e3deaa423c2c072546e11683bc23349bb2e759d027f49b661fa3
MD5 fdebfe09f99275116ef0be9bf6a49509
BLAKE2b-256 538bf9af6eb1d51a92d5db447af7f885607197164a3550cb67ab31ca7eb924ce

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

This release

0.3.2 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

1 file

0.2.0

1 file

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page