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