Skip to main content

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.1

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

Source distribution (sdist)

Source distribution for inline-snapshot-numpy 0.2.1
File Size Uploaded Provenance Actions
inline_snapshot_numpy-0.2.1.tar.gz 151.3 kB With provenance Details for inline_snapshot_numpy-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inline-snapshot-numpy 0.2.1
File Interpreter ABI Platform Actions
inline_snapshot_numpy-0.2.1-py3-none-any.whl Python 3 none any Details for inline_snapshot_numpy-0.2.1-py3-none-any.whl

Total release size: 157.7 kB

Release files / inline_snapshot_numpy-0.2.1.tar.gz

Download URL inline_snapshot_numpy-0.2.1.tar.gz
Size 151.3 kB
Tags Source
SHA-256 checksum
How to use checksums
609aa83e60053fbd0d2f1a1e664504eeb93103918d4158d69a505821c817d1f7
BLAKE2b-256 checksum
How to use checksums
8f77675ba1b925d94c52951b6224d0632c2e29ef8cbfa40f9fa28f2bb4a73339
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 Nov 20, 2026.

Transparency log

Release files / inline_snapshot_numpy-0.2.1-py3-none-any.whl

Download URL inline_snapshot_numpy-0.2.1-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a4dafea59c708bdbdb393ae3c39cc4bfb0da3e32d8ba945f0ec84bd7a22db35
BLAKE2b-256 checksum
How to use checksums
1b8364dd628fe27ed6aab04bbcd7c3cd00df39a5d9946da25df84aae2ab55d49
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 Nov 20, 2026.

Transparency log

Security for inline-snapshot-numpy 0.2.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for inline_snapshot_numpy-0.2.1.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 Nov 20, 2026.

Transparency log

A 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.

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