Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / dataclasses-serialization / default.nix
bloba52135ddaf6fe78fb06062ca91c1e4e8a81885f6
1 { lib
2 , buildPythonPackage
3 , pythonOlder
4 , fetchFromGitHub
5 , more-properties
6 , typing-inspect
7 , toolz
8 , toposort
9 , bson
10 , pytestCheckHook
13 buildPythonPackage rec {
14   pname = "dataclasses-serialization";
15   version = "1.3.1";
17   # upstream requires >= 3.6 but only 3.7 includes dataclasses
18   disabled = pythonOlder "3.7";
20   format = "setuptools";
22   src = fetchFromGitHub {
23     owner = "madman-bob";
24     repo = "python-dataclasses-serialization";
25     rev = version;
26     hash = "sha256-jLMR2D01KgzHHRP0zduMBJt8xgBmIquWLCjZYLo2/AA=";
27   };
29   postPatch = ''
30     mv pypi_upload/setup.py .
31     substituteInPlace setup.py \
32       --replace "project_root = Path(__file__).parents[1]" "project_root = Path(__file__).parents[0]"
34     # dataclasses is included in Python 3.7
35     substituteInPlace requirements.txt \
36       --replace dataclasses ""
38     # https://github.com/madman-bob/python-dataclasses-serialization/issues/16
39     sed -i '/(\(Dict\|List\)/d' tests/test_json.py tests/test_bson.py
40   '';
42   propagatedBuildInputs = [
43     more-properties
44     typing-inspect
45     toolz
46     toposort
47   ];
49   nativeCheckInputs = [
50     bson
51     pytestCheckHook
52   ];
54   pythonImportsCheck = [
55     "dataclasses_serialization.bson"
56     "dataclasses_serialization.json"
57     "dataclasses_serialization.serializer_base"
58   ];
60   meta = {
61     description = "Serialize/deserialize Python dataclasses to various other data formats";
62     homepage = "https://github.com/madman-bob/python-dataclasses-serialization";
63     license = lib.licenses.mit;
64     maintainers = with lib.maintainers; [ dotlambda ];
65   };