inline-snapshot-numpy
NumPy integration for inline-snapshot.
Installation
pip install inline-snapshot-numpy
Usage
The package provides snapshot-aware versions of NumPy's array assertions:
from inline_snapshot_numpy import assert_array_equal
from numpy import array
def test_array():
actual = array([[1, 2], [3, 4]])
assert_array_equal(actual)
Create the missing snapshot with:
pytest --inline-snapshot=create
The test will become:
def test_array():
actual = array([[1, 2], [3, 4]])
assert_array_equal(actual, desired=array([[1, 2], [3, 4]]))
The following helpers are available: assert_array_equal, assert_allclose,
assert_array_almost_equal, assert_array_almost_equal_nulp,
and assert_array_max_ulp.
The expected array is managed through snapshot_arg(), so no explicit
snapshot() call or import is needed. You can still pass an explicit
snapshot(...) for compatibility.
Alternatively, call setup() from conftest.py to patch the corresponding
functions in numpy.testing:
from inline_snapshot_numpy import setup
setup()
Arrays can also be stored in external .npy snapshot files:
from inline_snapshot import external
from inline_snapshot_numpy import assert_array_equal
from numpy import array
def test_array():
assert_array_equal(array([1, 2, 3]), external())
Create the external snapshot with pytest --inline-snapshot=create. NumPy object
arrays are intentionally rejected because loading them would require enabling
pickle. Snapshot reports render the array shape, dtype, and values as text, and
array changes are shown as a unified text diff instead of a binary hexdump.
License
Distributed under the terms of the MIT license.
Metadata
Release files for inline-snapshot-numpy 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| inline_snapshot_numpy-0.2.0.tar.gz | 149.4 kB | With provenance | Details for inline_snapshot_numpy-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inline_snapshot_numpy-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for inline_snapshot_numpy-0.2.0-py3-none-any.whl |
Total release size: 155.8 kB
Release files / inline_snapshot_numpy-0.2.0.tar.gz
| Download URL | inline_snapshot_numpy-0.2.0.tar.gz |
|---|---|
| Size | 149.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f648d18067b34ff2be9ee1eb89fcbebd0a686e2415c52042ff2fead98496fd3d
|
|
BLAKE2b-256 checksum How to use checksums |
dabf951e7396047932bf961b2fddfee81a12e25b31d74e02746aae507e0840ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / inline_snapshot_numpy-0.2.0-py3-none-any.whl
| Download URL | inline_snapshot_numpy-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dbce2ce6091fcdae57f75af8e51943dcd95ecb17726f74ea554931a305a48da9
|
|
BLAKE2b-256 checksum How to use checksums |
cff79e824a0f6702afac01943778d233b57b925993494e785d3c4682db64950c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for inline-snapshot-numpy 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for inline_snapshot_numpy-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.