NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2710 most downloaded on PyPI
golden master/snapshot/approval testing library which puts the values right into your source code
Last release 2 days ago
02 Oct 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
104 releases · first in 2022
One column per quarter.
fixed a crash when you changed the snapshot to use a custom constructor method for dataclass/pydantic models.
fixed a crash when you changed the snapshot to use a custom constructor method for dataclass/pydantic models.
example:
from inline_snapshot import snapshot
from pydantic import BaseModel
class A(BaseModel):
a: int
@classmethod
def from_str(cls, s):
return cls(a=int(s))
def test_something():
assert A(a=2) == snapshot(A.from_str("1"))
added the optional inline-snapshot[dirty-equals] dependency to depend on the dirty-equals version which works in combination with inline-snapshot.
inline-snapshot[dirty-equals] dependency to depend on the dirty-equals version which works in combination with inline-snapshot.snapshots with pydantic models can now be compared multiple times
class A(BaseModel):
a: int
def test_something():
for _ in [1, 2]:
assert A(a=1) == snapshot(A(a=1))
You can now specify which tool you want to use to format your code by setting a format-command in your configuration.
format-command in your configuration.inline-snapshot[black] now if you want to format your code like in the previous versions. This option is not required if you use a format-command.[tool.inline-snapshot] is missing.
This makes the documented default shortcuts --review and --fix work.use '.model_fields' on pydantic model class and not instance. This fixes a deprecation warning in the upcomming pydantic v2.11
[dependency-groups] to pyproject.toml and use uv and pytest to run tests in CI.uv is now only used during test time if you run the inline-snapshot tests with pytest --use-uv This solves a problem if you want to package inline-sna
pytest --use-uv
This solves a problem if you want to package inline-snapshot in distributions (#165)Support for a new storage-dir configuration option, to tell inline-snapshot where to store data files such as external snapshots.
storage-dir configuration option, to tell inline-snapshot where to store data files such as external snapshots.pydantic v1 is supported again. pydantic v1 & v2 create now the same snapshots. You can use .dict() to get the same snapshots like in inline-snapshot-0.15.0 for pydantic v1.
class M(BaseModel):
name: str
def test_pydantic():
m = M(name="Tom")
assert m == snapshot(M(name="Tom"))
assert m.dict() == snapshot({"name": "Tom"})
Find pyproject.toml file in parent directories, not just next to the Pytest configuration file.
Code generation for sets is now deterministic. ` python def test(): assert {1j, 2j, 1, 2, 3} == snapshot({1, 1j, 2, 2j, 3}) `
def test():
assert {1j, 2j, 1, 2, 3} == snapshot({1, 1j, 2, 2j, 3})
def test (): assert { 1 j , 2 j , 1 , 2 , 3 } == snapshot ({ 1 , 1 j , 2 , 2 j , 3 })
attrs can now contain unmanaged values
attrs can now contain unmanaged values
import datetime as dt
import uuid
import attrs
from dirty_equals import IsDatetime
from inline_snapshot import Is, snapshot
@attrs.define
class Attrs:
ts: dt.datetime
id: uuid.UUID
def test():
id = uuid.uuid4()
assert Attrs(dt.datetime.now(), id) == snapshot(
Attrs(ts=IsDatetime(), id=Is(id))
)
`inline_snapshot.extra.warns` to captures warnings and compares them against expected warnings. ` python def test_warns(): with warns(snapshot([(8, "U
inline_snapshot.extra.warns to captures warnings and compares them against expected warnings.def test_warns():
with warns(snapshot([(8, "UserWarning: some problem")]), include_line=True):
warn("some problem")
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.15.1...v0.16.0
solved a bug caused by a variable inside a snapshot
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.15.0...v0.15.1
snapshots inside snapshots are now supported.
snapshots inside snapshots are now supported.
assert get_schema() == snapshot(
[
{
"name": "var_1",
"type": snapshot("int") if version < 2 else snapshot("string"),
}
]
)
runtime values can now be part of snapshots.
from inline_snapshot import snapshot, Is
current_version = "1.5"
assert request() == snapshot(
{"data": "page data", "version": Is(current_version)}
)
f-strings can now also be used within snapshots, but are currently not fixed by inline-snapshot.
inline-snapshot checks now if the given command line flags (--inline-snapshot=...) are valid
Example(...).run_pytest(raise=snapshot(...)) uses now the flags from the current run and not the flags from the Example.
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.14.2...v0.15.0
do not crash when handling raw f-strings (rf"",RF"",...)
rf"",RF"",...) (#143)Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.14.1...v0.14.2
Don't crash for snapshots like snapshot(f"") (#139) It first appeared with pytest-8.3.4, but already existed before for cpython-3.11. f-strings in sna
Don't crash for snapshots like snapshot(f"") (#139)
It first appeared with pytest-8.3.4, but already existed before for cpython-3.11.
f-strings in snapshots are currently not official supported, but they should not lead to crashes.
skip formatting if black returns an error (#138)
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.14.0...v0.14.1
command line shortcuts can be defined to simplify your workflows. --review and --fix are defined by default. See the documentation for details.
--review and --fix are defined by default. See the documentation for details."Programming Language :: Python :: Implementation :: PyPy" classifier which was incorrect, because inline-snapshot can not fix snapshots on pypy.
inline-snapshot now enforces --inline-snapshot=disable when used with an implementation other than cpython, which allows it to be used in packages that want to support pypy.--inline-snapshot=create/fix/trim/update will no longer show reports for other categories.
You can use --inline-snapshot=create,report if you want to use the old behaviour.Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.13.4...v0.14.0
fix: use tomli instead of toml (#130) by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/131
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.13.3...v0.13.4
removed non-optional dirty-equals dependency
star-expressions in list or dicts where never valid and cause a warning now. ` other=[2] assert [5,2]==snapshot([5,*other]) `
other=[2]
assert [5,2]==snapshot([5,*other])
A snapshot which contains an dirty-equals expression can now be compared multiple times.
def test_something():
greeting = "hello"
for name in ["alex", "bob"]:
assert (name, greeting) == snapshot((IsString(), "hello"))
other=[2]
assert [5,2]==snapshot([5,*other])
A snapshot which contains an dirty-equals expression can now be compared multiple times.
def test_something():
greeting = "hello"
for name in ["alex", "bob"]:
assert (name, greeting) == snapshot((IsString(), "hello"))
enum.Enum, enum.Flag, type and omitting of default values (#73)--inline-snapshot-disable option and replaced it with --inline-snapshot=disable__all__ to inline_snapshotcopy.deepcopyl = [1]
assert l == snapshot([1]) # old behaviour: snapshot([1, 2])
l.append(2)
assert l == snapshot([1, 2])
value <= snapshot() to ensure that something gets smaller/larger over time (number of iterations of an algorithm you want to optimize for example),
value in snapshot() to check if your value is in a known set of values,
snapshot()[key] to generate new sub-snapshots on demand.
convert strings with newlines to triple quoted strings
assert "a\nb\n" == snapshot(
"""a
b
"""
)
preserve black formatting
Use tomllib instead of PyPI toml on Python 3.11 and later by @musicinmybrain in https://github.com/15r10nk/inline-snapshot/pull/115
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.13.0...v0.13.1
The new prints function allows you to snapshot the output of your code. ``` python from inline_snapshot import snapshot from inline_snapshot.extra imp
The new prints function allows you to snapshot the output of your code.
from inline_snapshot import snapshot
from inline_snapshot.extra import prints
import sys
def test_prints():
with prints(
stdout=snapshot("hello world\n"), stderr=snapshot("some error\n")
):
print("hello world")
print("some error", file=sys.stderr)
I started also a list of all third-party extensions
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.12.1...v0.13.0
fix: add license to project metadata by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/105
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.12.0...v0.12.1
feat: implement inline_snapshot.extra.raises by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/102
inline_snapshot.extra.raises by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/102inline_snapshot.testing.Example which can be used to test 3rd-party extensions by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/95Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.11.0...v0.12.0
support for enum.Enum, enum.Flag, type and omitting of default values
enum.Enum, enum.Flag, type and omitting of default valuesFull Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.10.2...v0.11.0
fix: changed how --inline-snapshot=disable works in combination with xdist by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/93
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.10.1...v0.10.2
fix: trigger no update for trailing comma changes by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/91
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.10.0...v0.10.1
removed --inline-snapshot-disable option and replaced it with --inline-snapshot=disable
--inline-snapshot-disable option and replaced it with --inline-snapshot=disableFull Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.9.0...v0.10.0
ci: use macos-13 by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/83
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.8.2...v0.9.0
removed restriction that the snapshot functions has to be called snapshot (#72) which allows you to use `python from inline_snapshot import snapshot a
from inline_snapshot import snapshot as snap
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.8.1...v0.8.2
fixed problems with the typing of the following snapshots:
fixed problems with the typing of the following snapshots:
snapshot([])
snapshot({})
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.8.0...v0.8.1
Snapshot parts can now be replaced by dirty-equals expressions. These parts will not be changed if the user uses --inline-snapshot=fix. This should pr
Snapshot parts can now be replaced by dirty-equals expressions. These parts will not be changed if the user uses --inline-snapshot=fix. This should provide more flexibility if snapshots change frequently for unimportant reasons.
from inline_snapshot import snapshot
from dirty_equals import IsDatetime
import datetime
def get_data():
return {
"date": datetime.datetime.utcnow(),
"payload": "some data",
}
def test_function():
assert get_data() == snapshot(
{
"date": IsDatetime(),
"payload": "some data",
}
)
Thank you to @alexmojaki for the Idea.
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.7.0...v0.8.0
feat!: removed deprecated --update-snapshots option by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/55
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.6.1...v0.7.0
fixed windows support (use utf-8 encoding to read and write source files) by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/44
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.6.0...v0.6.1
snapshot values can now be saved in external files:
snapshot values can now be saved in external files:
assert outsource("large string\n" * 1000) == snapshot(external("8bf10bdf2c30*.txt"))
see the documentation for more details
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.5.2...v0.6.0
fix: remove upper bound from dependencies in pyproject.toml by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/39
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.5.1...v0.5.2
show the user better error messages when he mixes snapshot operations.
show the user better error messages when he mixes snapshot operations.
def test_something():
s = snapshot(5)
assert 5 <= s
assert 5 == s
> assert 5 == s
E TypeError: This snapshot cannot be use with `==`, because it was previously used with `x <= snapshot`
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.5.0...v0.5.1
fix: do not change an empty snapshot if it is not used
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.4.0...v0.5.0
Multiline strings are now formatted so that the quotes are always on a separate line.
Multiline strings are now formatted so that the quotes are always on a separate line.
def test_something():
assert "\nfirst line\nsecond line" == snapshot(
"""\
first line
second line\
"""
)
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.3.2...v0.4.0
correct handling of flags for sub-snapshots:
correct handling of flags for sub-snapshots:
from inline_snapshot import snapshot
def test_foo():
s = snapshot(
{
"hello": "world",
"number": 8,
"values": ["old value"], # trim: remove "old value"
}
)
assert "mars" == s["hello"] # fix: change "world" to "mars"
assert 5 <= s["number"] # trim: change 8 to 5
assert "some output" in s["known output"] # create: add "known output": ["some output"]
assert "new value" in s["values"] # fix: add "new value"
pytest --inline-snapshot=create|fix|trim will apply the changes to the snapshot
every flag implies --inline-snapshot=update
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.3.1...v0.3.2
fix: flags fix/trim/create/update are changing the matching snapshots by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/15
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.3.0...v0.3.1
docs: added contributing.md by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/10
copy.deepcopyFull Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.2.1...v0.3.0
fix: black configuration files are respected by @15r10nk in https://github.com/15r10nk/inline-snapshot/pull/8
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.2.0...v0.2.1
support for new snapshot operations:
support for new snapshot operations:
value <= snapshot() to ensure that something gets smaller/larger over time (number of iterations of an algorithm you want to optimize for example),value in snapshot() to check if your value is in a known set of values,snapshot()[key] to generate new sub-snapshots on demand.new features:
more information can be found in the new documentation
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →