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