Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 # dataclasses is included in Python 3.7 36 substituteInPlace requirements.txt \ 37 --replace dataclasses "" 38 39 # https://github.com/madman-bob/python-dataclasses-serialization/issues/16 40 sed -i '/(\(Dict\|List\)/d' tests/test_json.py tests/test_bson.py 41 ''; 42 43 propagatedBuildInputs = [ 44 more-properties 45 typing-inspect 46 toolz 47 toposort 48 ]; 49 50 nativeCheckInputs = [ 51 bson 52 pytestCheckHook 53 ]; 54 55 pythonImportsCheck = [ 56 "dataclasses_serialization.bson" 57 "dataclasses_serialization.json" 58 "dataclasses_serialization.serializer_base" 59 ]; 60 61 meta = { 62 description = "Serialize/deserialize Python dataclasses to various other data formats"; 63 homepage = "https://github.com/madman-bob/python-dataclasses-serialization"; 64 license = lib.licenses.mit; 65 maintainers = with lib.maintainers; [ dotlambda ]; 66 }; 67}