at 22.05-pre 1.9 kB view raw
1{ lib 2, attrs 3, buildPythonPackage 4, fetchFromGitHub 5, hypothesis 6, immutables 7, motor 8, msgpack 9, poetry-core 10, pytestCheckHook 11, pythonOlder 12, pyyaml 13, tomlkit 14, ujson 15}: 16 17buildPythonPackage rec { 18 pname = "cattrs"; 19 version = "1.8.0"; 20 format = "pyproject"; 21 22 # https://cattrs.readthedocs.io/en/latest/history.html#id33: 23 # "Python 2, 3.5 and 3.6 support removal. If you need it, use a version below 1.1.0." 24 disabled = pythonOlder "3.7"; 25 26 src = fetchFromGitHub { 27 owner = "Tinche"; 28 repo = pname; 29 rev = "v${version}"; 30 sha256 = "sha256-CKAsvRKS8kmLcyPA753mh6d3S04ObzO7xLPpmlmxrxI="; 31 }; 32 33 nativeBuildInputs = [ 34 poetry-core 35 ]; 36 37 propagatedBuildInputs = [ 38 attrs 39 ]; 40 41 checkInputs = [ 42 hypothesis 43 immutables 44 motor 45 msgpack 46 pytestCheckHook 47 pyyaml 48 tomlkit 49 ujson 50 ]; 51 52 postPatch = '' 53 substituteInPlace setup.cfg \ 54 --replace "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" "" 55 substituteInPlace pyproject.toml \ 56 --replace 'orjson = "^3.5.2"' "" 57 substituteInPlace tests/test_preconf.py \ 58 --replace "from orjson import dumps as orjson_dumps" "" \ 59 --replace "from orjson import loads as orjson_loads" "" 60 ''; 61 62 preCheck = '' 63 export HOME=$(mktemp -d); 64 ''; 65 66 disabledTestPaths = [ 67 # Don't run benchmarking tests 68 "bench/test_attrs_collections.py" 69 "bench/test_attrs_nested.py" 70 "bench/test_attrs_primitives.py" 71 "bench/test_primitives.py" 72 ]; 73 74 disabledTests = [ 75 # orjson is not available as it requires Rust nightly features to compile its requirements 76 "test_orjson" 77 ]; 78 79 pythonImportsCheck = [ "cattr" ]; 80 81 meta = with lib; { 82 description = "Python custom class converters for attrs"; 83 homepage = "https://github.com/Tinche/cattrs"; 84 license = with licenses; [ mit ]; 85 maintainers = with maintainers; [ fab ]; 86 }; 87}