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)
| File | Size | Uploaded | |
|---|---|---|---|
| nbcheckmate-0.1.8.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|