pypi / inline-snapshot
inline-snapshot
What changed in inline-snapshot 0.30 to 0.37, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
5 breaking1 deprecations13 new APIs and options6 performance13 behavior and defaults4 tooling24 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initinline-snapshot 0.371 changes
New APIs and options 1
Extensions can use is_snapshot() to recognize inline and external snapshot objects.
inline-snapshot 0.369 changes
Breaking changes 1
Built-in literal values are always managed; registering their types as unmanaged now raises TypeError.
New APIs and options 1
The hook receives the corresponding existing snapshot value, or
...when there is no corresponding snapshot.
Performance 5
Reduces memory use by eagerly recording snapshot changes without retaining completed test frames until the final report.
Comparisons avoid unnecessary deep copies of immutable built-in values.
Conversion of literal constants is faster, especially for large lists and dictionaries.
Conversion reads AST constant values directly instead of compiling and evaluating them.
Source representations are generated only when needed, improving performance when comparing matching snapshots with updates disabled.
Behavior and default changes 1
Registrations are scoped to the current snapshot context and inherited from the parent context.
Fixes and other changes 1
The short report now hides snapshot representation change messages when show-updates is disabled.
inline-snapshot 0.357 changes
New APIs and options 1
Added Builder.create_set() for creating set expressions in customization functions.
Behavior and default changes 2
Tracks source files that use external snapshots and uses the list to detect and trim unused external snapshots.
Used only as a compatibility fallback when
files_using_external.txtdoes not exist yet.
Fixes and other changes 4
Trimming no longer changes snapshots when a test fails or pytest is limited to selected tests; skipped tests and fixture teardown errors do not block it. An explicit trim request overrides the safeguard.
Fixed a crash during session finalization when pytest's capture plugin is disabled.
Providing an unknown --inline-snapshot flag no longer crashes, runs report finalization, or modifies external snapshot tracking files.
Serialization is deterministic for partially ordered values such as incomparable frozenset members.
inline-snapshot 0.343 changes
New APIs and options 1
Accepts which="new" or which="old" to select the new just-compared or old previously stored snapshot value.
Fixes and other changes 2
Uses the fix category instead of create when creating an argument with an existing non-ellipsis default argument value.
Makes test order deterministic by using
-p no:ranodmly.
inline-snapshot 0.3314 changes
Breaking changes 1
reported_categories uses snapshot_arg(), changes from list[Category] to set[Category], and is asserted only when categories differ from CLI flags passed via args.
New APIs and options 3
New method formats a Python file in the example using Black.
New method checks whether a Python file in the example is already Black-formatted.
New helper lets you move snapshot() calls from the call site into the helper function itself.
Behavior and default changes 6
The raises, stderr, and changed_files arguments use snapshot_arg(), so snapshot() is no longer needed at the call site; raises defaults to "<no exception>" and changed_files to {}.
Exception strings in raises are formatted like inline_snapshot.extra.raises, producing shorter strings for small assertions.
The error assertion is performed only on Python 3.11 and later.
stdout and stderr are printed as Rich panels instead of plain text.
The stdout and stderr arguments use snapshot_arg(), so snapshot() is no longer needed at the call site.
The value argument is now handled with snapshot_arg().
Tooling 3
The returncode, error, stderr, changed_files, and outcomes arguments use snapshot_arg(), removing the need for call-site snapshot(); returncode defaults to 0, changed_files to {}, and outcomes to {"passed": 1}.
The exception argument uses snapshot_arg(), so snapshot() is no longer needed at the call site.
The expected_warnings argument uses snapshot_arg(), so snapshot() is no longer needed at the call site.
Fixes and other changes 1
repr(external_file(...)) now uses a path relative to the calling file instead of an absolute path, fixing incorrect reprs on Windows.
inline-snapshot 0.3224 changes
Breaking changes 1
Support for Python 3.8 has been removed because it is end-of-life.
Deprecations 1
@customize_repr is deprecated and can be replaced with @customize.
New APIs and options 6
Added a parameter for injecting context managers that stay active during show_report().
Values can be stored in external files automatically based on custom criteria, such as string length or data size.
The new @customize decorator provides a way to customize snapshot creation.
Built-in handlers for datetime.datetime, date, time, and timedelta generate clean snapshots with proper imports.
Import statement generation is supported for all types and user-customized code.
A plugin system lets developers reuse customizations across multiple projects.
Performance 1
Improved snapshot() performance by using lazy evaluation.
Behavior and default changes 2
Generated snapshots use __file__ instead of the current source file's filename string.
When a time value equals the current time, snapshots use dirty-equals IsNow() instead of the current datetime.
Fixes and other changes 13
Fixed comparison of dict snapshots with dataclass instances or other custom objects as keys, preventing entries from collapsing or duplicate keys from being appended on subsequent runs.
Tuple snapshot updates now compare elements positionally rather than using sequence alignment, preserving existing expressions when elements are added or removed.
Snapshots for Pydantic models, attrs and dataclasses now wrap NewType-typed field values with the NewType constructor on Python 3.10 and later.
Fixed problems caused by tuples used as snapshot keys having the same hash value.
Filtering tests with -k no longer causes an error during session teardown when matchers are used.
Fixed code generation for Call objects created with builder.create_call().
The handler for datetime types is now used only for concrete types, not subclasses.
Tuples in snapshots are no longer converted internally into lists when evaluated more than once.
Timezone information is now included in snapshots, and timezone.utc is represented with the correct import.
Customize hook registration checks that objects are functions before inspecting the inline_snapshot_impl attribute, preventing potential attribute errors when scanning conftest modules.
Path and PurePath values are never stored as PosixPath, WindowsPath, or their Pure variants, improving platform-independent tests.
The pytest --color flag is now respected.
raises catches BaseException instead of Exception, so SystemExit and KeyboardInterrupt are also caught.
inline-snapshot 0.315 changes
Breaking changes 2
Format commands using pipelines now fail if any command returns a non-zero exit code, rather than checking only the last command.
Using external outside tests/ (or a configured test-dir) now raises an exception.
Behavior and default changes 1
Users are notified when multiple external snapshots use the same UUID, which can happen when copying a test as a template.
Fixes and other changes 2
The lookup for external snapshots has been improved.
Session hints now use --inline-snapshot instead of --snapshot.
inline-snapshot 0.303 changes
Behavior and default changes 1
The test-dir config option can now also be a list of paths.
Tooling 1
Python 3.14 is now supported.
Fixes and other changes 1
Disables ASCII escaping in json.dump so non-ASCII characters in external files are supported.