1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hypothesis,
6 marshmallow,
7 poetry-core,
8 poetry-dynamic-versioning,
9 pytestCheckHook,
10 pythonOlder,
11 typing-inspect,
12}:
13
14buildPythonPackage rec {
15 pname = "dataclasses-json";
16 version = "0.6.7";
17 pyproject = true;
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "lidatong";
23 repo = "dataclasses-json";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-AH/T6pa/CHtQNox67fqqs/BBnUcmThvbnSHug2p33qM=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace-fail 'version = "0.0.0"' 'version = "${version}"'
31 '';
32
33 build-system = [
34 poetry-core
35 poetry-dynamic-versioning
36 ];
37
38 dependencies = [
39 typing-inspect
40 marshmallow
41 ];
42
43 nativeCheckInputs = [
44 hypothesis
45 pytestCheckHook
46 ];
47
48 disabledTestPaths = [
49 # fails with the following error and avoid dependency on mypy
50 # mypy_main(None, text_io, text_io, [__file__], clean_exit=True)
51 # TypeError: main() takes at most 4 arguments (5 given)
52 "tests/test_annotations.py"
53 ];
54
55 pythonImportsCheck = [ "dataclasses_json" ];
56
57 meta = with lib; {
58 description = "Simple API for encoding and decoding dataclasses to and from JSON";
59 homepage = "https://github.com/lidatong/dataclasses-json";
60 changelog = "https://github.com/lidatong/dataclasses-json/releases/tag/v${version}";
61 license = licenses.mit;
62 maintainers = with maintainers; [ albakham ];
63 };
64}