at master 2.2 kB view raw
1{ 2 lib, 3 attrs, 4 buildPythonPackage, 5 cbor2, 6 fetchFromGitHub, 7 exceptiongroup, 8 hatchling, 9 hatch-vcs, 10 hypothesis, 11 immutables, 12 motor, 13 msgpack, 14 msgspec, 15 orjson, 16 pytest-xdist, 17 pytestCheckHook, 18 pythonAtLeast, 19 pythonOlder, 20 pyyaml, 21 tomlkit, 22 typing-extensions, 23 ujson, 24}: 25 26buildPythonPackage rec { 27 pname = "cattrs"; 28 version = "25.1.1"; 29 pyproject = true; 30 31 src = fetchFromGitHub { 32 owner = "python-attrs"; 33 repo = "cattrs"; 34 tag = "v${version}"; 35 hash = "sha256-kaB/UJcd4E4PUkz6mD53lXtmj4Z4P+Tuu7bSljYVOO4="; 36 }; 37 38 build-system = [ 39 hatchling 40 hatch-vcs 41 ]; 42 43 dependencies = [ 44 attrs 45 typing-extensions 46 ] 47 ++ lib.optionals (pythonOlder "3.11") [ 48 exceptiongroup 49 ]; 50 51 nativeCheckInputs = [ 52 cbor2 53 hypothesis 54 immutables 55 motor 56 msgpack 57 msgspec 58 orjson 59 pytest-xdist 60 pytestCheckHook 61 pyyaml 62 tomlkit 63 ujson 64 ]; 65 66 postPatch = '' 67 substituteInPlace pyproject.toml \ 68 --replace-fail "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" "" 69 substituteInPlace tests/test_preconf.py \ 70 --replace-fail "from orjson import dumps as orjson_dumps" "" \ 71 --replace-fail "from orjson import loads as orjson_loads" "" 72 ''; 73 74 preCheck = '' 75 export HOME=$(mktemp -d); 76 ''; 77 78 disabledTestPaths = [ 79 # Don't run benchmarking tests 80 "bench" 81 ]; 82 83 disabledTests = [ 84 # orjson is not available as it requires Rust nightly features to compile its requirements 85 "test_orjson" 86 # msgspec causes a segmentation fault for some reason 87 "test_simple_classes" 88 "test_msgspec_json_converter" 89 ] 90 ++ lib.optionals (pythonAtLeast "3.13") [ 91 # https://github.com/python-attrs/cattrs/pull/543 92 "test_unstructure_deeply_nested_generics_list" 93 ]; 94 95 pythonImportsCheck = [ "cattr" ]; 96 97 meta = { 98 description = "Python custom class converters for attrs"; 99 homepage = "https://github.com/python-attrs/cattrs"; 100 changelog = "https://github.com/python-attrs/cattrs/blob/${src.tag}/HISTORY.md"; 101 license = with lib.licenses; [ mit ]; 102 maintainers = with lib.maintainers; [ fab ]; 103 }; 104}