summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/dataclasses-json/default.nix
blob: a0415aa726bd92388726e718ffec022b862a8c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  hypothesis,
  marshmallow,
  poetry-core,
  poetry-dynamic-versioning,
  pytestCheckHook,
  typing-inspect,
}:

buildPythonPackage rec {
  pname = "dataclasses-json";
  version = "0.6.7";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "lidatong";
    repo = "dataclasses-json";
    tag = "v${version}";
    hash = "sha256-AH/T6pa/CHtQNox67fqqs/BBnUcmThvbnSHug2p33qM=";
  };

  patches = [
    ./marshmallow-4.0-compat.patch
    # https://github.com/lidatong/dataclasses-json/pull/565
    ./python-3.14-compat.patch
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail 'documentation =' 'Documentation =' \
      --replace-fail 'version = "0.0.0"' 'version = "${version}"'
  '';

  build-system = [
    poetry-core
    poetry-dynamic-versioning
  ];

  pythonRelaxDeps = [ "marshmallow" ];

  dependencies = [
    typing-inspect
    marshmallow
  ];

  nativeCheckInputs = [
    hypothesis
    pytestCheckHook
  ];

  disabledTests = [
    # fails to deserialize None with marshmallow 4.0
    "test_deserialize"
  ];

  disabledTestPaths = [
    # fails with the following error and avoid dependency on mypy
    # mypy_main(None, text_io, text_io, [__file__], clean_exit=True)
    # TypeError: main() takes at most 4 arguments (5 given)
    "tests/test_annotations.py"
  ];

  pythonImportsCheck = [ "dataclasses_json" ];

  meta = {
    description = "Simple API for encoding and decoding dataclasses to and from JSON";
    homepage = "https://github.com/lidatong/dataclasses-json";
    changelog = "https://github.com/lidatong/dataclasses-json/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ albakham ];
  };
}