1{ lib 2, buildPythonPackage 3, pythonOlder 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 disabled = pythonOlder "3.7"; 19 20 format = "setuptools"; 21 22 src = fetchFromGitHub { 23 owner = "madman-bob"; 24 repo = "python-dataclasses-serialization"; 25 rev = version; 26 hash = "sha256-jLMR2D01KgzHHRP0zduMBJt8xgBmIquWLCjZYLo2/AA="; 27 }; 28 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]" 33 34 # dataclasses is included in Python 3.7 35 substituteInPlace requirements.txt \ 36 --replace dataclasses "" 37 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 ''; 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}