skillfed

inline-snapshot

golden master/snapshot/approval testing library which puts the values right into your source code

inline-snapshot v0.35.4 2.1M downloads/30d#3,271 on PyPI749
Permissive license Active released

What it is and what it does

inline-snapshot is a pytest plugin that embeds snapshot values directly in your test source code, turning snapshot testing into a code-first workflow. Instead of storing expected values in separate files, you write `snapshot()` placeholders in assertions, then run pytest with `--inline-snapshot=review` to see what values the test produces and approve them inline. The plugin rewrites your test file with the actual values, keeping your assertions and test logic in one place.

It supports multiple comparison modes (equality, ordering, membership, indexing), can store large snapshots externally, integrates with Black formatting, and works with normal assertions like `assert 1 + 1 == 3` as well as snapshot-specific syntax. Runtime dependencies are minimal: asttokens, executing, pytest, rich, tomli, and typing-extensions. The package is actively maintained, supports Python 3.9 through 3.14, and has no known security vulnerabilities.

Use it for:

  • Verify complex output (JSON, HTML, error messages) by embedding the expected result in your test and auto-updating it when the output legitimately changes.
  • Test function arguments and return values by using snapshot_arg() to capture and compare function parameters across test runs.
  • Maintain approval tests for command-line tools or subprocess output where you want to review and lock in expected behavior.
  • Compare structured data (nested dicts, lists) with fuzzy matching support via dirty-equals for flexible assertions on dynamic parts.
  • Store large or multiline snapshot data externally while keeping test logic readable and inline.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

inline-snapshot is a pytest plugin that lets you write snapshot tests by embedding expected values directly in your test code, then automatically updates those values when you review and approve changes.

Yes. inline-snapshot is actively maintained, has low install friction, zero known vulnerabilities, and solves a real problem for teams doing approval or golden-master testing. The inline-code-first approach is a genuine alternative to file-based snapshot tools. Install it if you want snapshot testing without managing separate snapshot files, or if you prefer reviewing and approving test changes as part of code review.

Install

inline-snapshot on PyPI

pip

pip install inline-snapshot

uv

uv add inline-snapshot

poetry

poetry add inline-snapshot

Installing inline-snapshot

Before you install

Low friction install with a pure-Python wheel. Active maintenance: released 3 days ago with 749 repository stars. Depends on six runtime packages (asttokens, executing, pytest, rich, tomli, typing-extensions), all common testing and utility libraries.

License in practice

MIT license (permissive). Free to use, modify, and distribute in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install inline-snapshot

from inline_snapshot import snapshot

def test_something():
    assert 1548 * 18489 == snapshot(28620972)

Requires pytest to be installed and tests to be run via pytest; review mode works best on CPython 3.11+ (older versions require --inline-snapshot=review flag).

Verify before relying

  • Whether the package works reliably with PyPy in practice despite classifier support.
  • Performance impact when working with very large snapshot datasets or many snapshots per test file.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 6 — asttokens, executing, pytest, rich, tomli, typing-extensions
Maintenance actively maintained — 3 days since the last release
Last repo commit
First released
Downloads 2,126,963/month — #3,271 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: inline_snapshot-0.35.4-py3-none-any.whl

Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Tags

snapshot testing pytestapproval testing inlinegolden master testingpytest assertion snapshotsautomatic test value updatesinline snapshot assertionssnapshot comparison testing
pytest-pluginapproval-testingsnapshot-testing

More Testing packages