1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, hypothesis
5, marshmallow-enum
6, poetry-core
7, poetry-dynamic-versioning
8, pytestCheckHook
9, pythonOlder
10, typing-inspect
11}:
12
13buildPythonPackage rec {
14 pname = "dataclasses-json";
15 version = "0.6.1";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "lidatong";
22 repo = pname;
23 rev = "refs/tags/v${version}";
24 hash = "sha256-pZohueZvEIGgY6isci2mGGBewfi9SwnHHy8OwyJGR0w=";
25 };
26
27 postPatch = ''
28 substituteInPlace pyproject.toml \
29 --replace 'version = "0.0.0"' 'version = "${version}"'
30 '';
31
32 nativeBuildInputs = [
33 poetry-core
34 poetry-dynamic-versioning
35 ];
36
37 propagatedBuildInputs = [
38 typing-inspect
39 marshmallow-enum
40 ];
41
42 nativeCheckInputs = [
43 hypothesis
44 pytestCheckHook
45 ];
46
47 disabledTestPaths = [
48 # fails with the following error and avoid dependency on mypy
49 # mypy_main(None, text_io, text_io, [__file__], clean_exit=True)
50 # TypeError: main() takes at most 4 arguments (5 given)
51 "tests/test_annotations.py"
52 ];
53
54 pythonImportsCheck = [
55 "dataclasses_json"
56 ];
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}