--- id: inline-snapshot version: "0.35.4" license: unclear license_treatment: permissive maintenance: active --- # inline-snapshot — golden master/snapshot/approval testing library which puts the values right into your source code License: permissive · Maintenance: active · Downloads: 2.1M/mo ## 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 above — 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 pip install inline-snapshot uv add inline-snapshot 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_current - Install friction: low - Maintenance: active - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags snapshot testing pytest, approval testing inline, golden master testing, pytest assertion snapshots, automatic test value updates, inline snapshot assertions, snapshot comparison testing, pytest-plugin, approval-testing, snapshot-testing [View on SkillFed](https://skillfed.io/packages/inline-snapshot) · [View on PyPI](https://pypi.org/project/inline-snapshot/)