Skip to main content

Nbcheckmate

Nb checkmate is your fellow library that allow you to test functions and variables inside of a notebook.

Installation

To install this package, you can use pip:

pip install nbcheckmate

Usage

To use this package, you can import it in your Python code:

from nbcheckmate.nbcheckmate import ResultsTests

results = ResultsTests("example", answer=42)
results.save()
print(results.get_results())

Create a tests directory alongside the notebook or in an ancestor directory, with a corresponding test_example.py. Tests can load the notebook data with ResultsTests.load("test_example.pkl") and inspect its variables and functions.

Runtime paths are excluded from saved state and reconstructed by ResultsTests.load() on the machine running the tests. This supports saving notebook state on Windows and testing it on Linux, or the reverse. Use compatible Python and dependency versions on both machines. Values supplied by the notebook must themselves be portable: concrete WindowsPath or PosixPath objects inside variables or captured function state are not converted automatically.

To run the notebook and tests locally, including in Windows PowerShell:

python -m pip install . nbclient ipykernel
python -c "import nbformat; from nbclient import NotebookClient; nb = nbformat.read('rugby-premiership.ipynb', as_version=4); NotebookClient(nb, timeout=120, kernel_name='python3').execute()"
python -m pytest -v

CI runs on Linux. Windows compatibility is validated locally using the commands above.

Metadata

Release files for nbcheckmate 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nbcheckmate 0.1.8
File Size Uploaded
nbcheckmate-0.1.8.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nbcheckmate 0.1.8
File Interpreter ABI Platform
nbcheckmate-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / nbcheckmate-0.1.8.tar.gz

Download URL nbcheckmate-0.1.8.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eab57a6d080f1aa6a6a790b2b1166f7bb2ff5bd621b10b6d6a729488ef7a5729
BLAKE2b-256 checksum
How to use checksums
c97ed18cf47ba6850ee01ce7a5b38f43328d7e7b98b98d1eab6b4e8ac401bd2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / nbcheckmate-0.1.8-py3-none-any.whl

Download URL nbcheckmate-0.1.8-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa90cb9c71d1405311e24ec80c86ba5869586e8b926557aff19948b6bdfae6f3
BLAKE2b-256 checksum
How to use checksums
e6c56a667a6739d0a81f854eb03406c243ef993c238e4574168902cfc07162f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release 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