Skip to main content

A simple linting tool to check if all notebooks execute

Project description

📓 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)
  • -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

📋 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

🔍 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

📊 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 (Raoul.Grouls@han.nl)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

notebooktester-0.2.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for notebooktester-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89c6006c975f463bdc6fc16e217ab87301b70fbc8ec98d2358a6e628f3519477
MD5 cc6b500cc8512dd944e6bceaf524dfae
BLAKE2b-256 63eb128dae9ca12d9956f7ffe59691ceca09844618f7249c56b0b8d57009c537

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page