1{
2 lib,
3 asttokens,
4 black,
5 buildPythonPackage,
6 dirty-equals,
7 executing,
8 fetchFromGitHub,
9 freezegun,
10 hatchling,
11 hypothesis,
12 pydantic,
13 pyright,
14 pytest-freezer,
15 pytest-mock,
16 pytest-subtests,
17 pytest-xdist,
18 pytestCheckHook,
19 pythonOlder,
20 rich,
21 time-machine,
22 toml,
23}:
24
25buildPythonPackage rec {
26 pname = "inline-snapshot";
27 version = "0.24.0";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "15r10nk";
32 repo = "inline-snapshot";
33 tag = version;
34 hash = "sha256-UiVxG9W1lwvvoflVey4250iL8gL8Tm41LBo0ab0tTqk=";
35 };
36
37 build-system = [ hatchling ];
38
39 dependencies = [
40 asttokens
41 executing
42 rich
43 toml
44 ]
45 ++ lib.optionals (pythonOlder "3.11") [
46 toml
47 ];
48
49 nativeCheckInputs = [
50 freezegun
51 hypothesis
52 pydantic
53 pyright
54 pytest-freezer
55 pytest-mock
56 pytest-subtests
57 pytest-xdist
58 pytestCheckHook
59 time-machine
60 ]
61 ++ lib.flatten (lib.attrValues optional-dependencies);
62
63 optional-dependencies = {
64 black = [ black ];
65 dirty-equals = [ dirty-equals ];
66 };
67
68 pythonImportsCheck = [ "inline_snapshot" ];
69
70 disabledTestPaths = [
71 # Tests don't play nice with pytest-xdist
72 "tests/test_typing.py"
73 ];
74
75 meta = with lib; {
76 description = "Create and update inline snapshots in Python tests";
77 homepage = "https://github.com/15r10nk/inline-snapshot/";
78 changelog = "https://github.com/15r10nk/inline-snapshot/blob/${src.tag}/CHANGELOG.md";
79 license = licenses.mit;
80 maintainers = with maintainers; [ fab ];
81 };
82}