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 tag = "v${version}";
25 hash = "sha256-AH/T6pa/CHtQNox67fqqs/BBnUcmThvbnSHug2p33qM=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace-fail 'documentation =' 'Documentation =' \
31 --replace-fail 'version = "0.0.0"' 'version = "${version}"'
32 '';
33
34 build-system = [
35 poetry-core
36 poetry-dynamic-versioning
37 ];
38
39 dependencies = [
40 typing-inspect
41 marshmallow
42 ];
43
44 nativeCheckInputs = [
45 hypothesis
46 pytestCheckHook
47 ];
48
49 disabledTestPaths = [
50 # fails with the following error and avoid dependency on mypy
51 # mypy_main(None, text_io, text_io, [__file__], clean_exit=True)
52 # TypeError: main() takes at most 4 arguments (5 given)
53 "tests/test_annotations.py"
54 ];
55
56 pythonImportsCheck = [ "dataclasses_json" ];
57
58 meta = with lib; {
59 description = "Simple API for encoding and decoding dataclasses to and from JSON";
60 homepage = "https://github.com/lidatong/dataclasses-json";
61 changelog = "https://github.com/lidatong/dataclasses-json/releases/tag/v${version}";
62 license = licenses.mit;
63 maintainers = with maintainers; [ albakham ];
64 };
65}