pypi / syrupy
syrupy
What changed in syrupy 5 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-21.
17 breaking9 new APIs and options6 performance1 behavior and defaults2 tooling20 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initsyrupy 714 changes
Breaking changes 2
Syrupy 7 requires Python 3.11 or later; Python 3.10 is no longer supported.
The experimental opt-in is removed; suites that pass this flag should drop it.
Performance 1
Worker-to-controller snapshot collection payloads use zlib level 1 for faster report compression.
Behavior and default changes 1
Amber write locking turns on automatically when pytest-xdist distributes work; single-process behavior is unchanged.
Tooling 1
CI and packaging now cover Python 3.15.
Fixes and other changes 9
Snapshot file extensions are now required to be complete.
An empty file_extension no longer crashes the session-finish report, and extensionless discovery no longer claims sibling snapshots with extensions such as .json or .raw.
Truncation reserves space for the dot and extension, preventing long ASCII test names from producing 256-character filenames and keeping truncated filenames tied to their tests.
When pytest runs without a path argument, snapshots for modules excluded from collection with --ignore or pytest_ignore_collect are no longer reported or deleted.
On Windows, lock creation retries when another process has locked the empty region before the sentinel write.
Last-failed runs are treated as partial sessions, so snapshots for tests that did not run are no longer deleted as unused.
Module-level pytest.importorskip() during path discovery no longer turns a skipped session into exit code 1.
Now discovers and removes unused snapshot collections when their owning test modules are gone, including empty per-test-file snapshot directories.
Workers send compressed collected items, and unused delete/fail is skipped when worker reports are incomplete, preventing a dropped worker report from breaking unused detection.
syrupy 615 changes
Breaking changes 3
The separate DataclassPlugin has been removed; remove its imports and plugin wiring because stdlib dataclasses are serialized natively by the Amber serializer.
The JSON extension serializes dates as YYYY-MM-DD instead of repr strings, so existing JSON snapshots containing dates need updating.
The Amber serializer now serializes stdlib dataclasses natively; without the former plugin, snapshots may change from repr-style strings to structured Amber form.
New APIs and options 5
Experimental opt-in for pytest-xdist that uses an exclusive file lock and atomic replace around amber writes to prevent workers from dropping snapshots.
Sets the maximum wait for the snapshot file lock; defaults to 60s.
Experimental option to write Amber snapshots in pytest collection/declaration order, including parametrize/ids order, instead of alphabetical snapshot name order.
snapshot(diff=...) accepts an in-memory baseline object, so tests can diff against data without writing a separate base snapshot.
Skips unused-snapshot discovery, reporting, and deletion, providing an escape hatch for very large Amber suites where unused detection dominates runtime.
Performance 3
Single-file extensions write updates immediately instead of buffering large payloads until session end, improving memory use; multi-entry Amber files still batch writes.
Under partial selection, unused detection considers only plausible test files, reducing its cost with sharding plugins such as pytest-split.
Worker-to-controller snapshot collection payloads are compressed, cutting transfer size for large suites.
Tooling 1
Tests that use the snapshot fixture, directly or indirectly, are marked automatically, allowing snapshot updates to target only those tests.
Fixes and other changes 3
With regex=False, path_value now replaces values at nested paths such as user.token; previously, default-mode lookup missed escaped path keys.
Sorting values such as homogeneous frozensets with partial ordering no longer depends on PYTHONHASHSEED, preventing flaky snapshots.
Skipped sibling single-file snapshots are no longer reported as unused or deleted during --snapshot-update.
syrupy 526 changes
Breaking changes 12
Unused snapshots are detected when using pytest-xdist, which may cause test suites that previously passed to fail. --snapshot-warn-unused downgrades detection from an error to a warning.
Renames
_file_extensiontofile_extensionas part of the public API naming changes.Renames
_get_file_basenametoget_file_basenameas part of the public API naming changes.The minimum required version of pytest is now v8.
Syrupy now requires Python 3.10 or higher; support for Python 3.8 has been dropped.
Renames
_read_snapshot_collectiontoread_snapshot_collectionas part of the public API naming changes.Renames
_read_snapshot_data_from_locationtoread_snapshot_data_from_locationas part of the public API naming changes.Removes
SNAPSHOT_DIRNAMEin favour of a property onSnapshotCollectionStorageand the associated CLI option.Renames
SNAPSHOT_EMPTY_FOSSIL_KEYtoSNAPSHOT_EMPTY_COLLECTION_KEY.Renames
_snapshot_sort_keytosnapshot_sort_keyas part of the public API naming changes.Renames
SNAPSHOT_UNKNOWN_FOSSIL_KEYtoSNAPSHOT_UNKNOWN_COLLECTION_KEY.Renames
_write_snapshot_collectiontowrite_snapshot_collectionas part of the public API naming changes.
New APIs and options 4
Keeps unused snapshots on update.
Adds the --snapshot-update-new-only flag.
Adds a serializer plugin system, including plugins for data models.
Adds an option to change the default directory where snapshots are stored.
Performance 2
Serialization avoids copying the cycle-detection set on every serialized node.
String serialization in the amber serializer is faster.
Fixes and other changes 8
Fixes detection of pytest-xdist when it is loaded via PYTEST_PLUGINS.
Defers registering the pytest-xdist hook to avoid an “unknown hook” error.
Honors boolean operators in snapshot selection.
Color control no longer mutates os.environ.
Serialization now handles unicode line-endings correctly.
The project switched to the MIT license for versions 5.0.0 and beyond; versions 4.x or earlier retain the previous Apache 2.0 license.
Ensures Syrupy's assertion hook is called first, improving compatibility with other plugins.
Fixes the terminal summary display when using
xdistworkers.