Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 orjson, 15 pytest-xdist, 16 pytestCheckHook, 17 pythonOlder, 18 pyyaml, 19 tomlkit, 20 typing-extensions, 21 ujson, 22}: 23 24buildPythonPackage rec { 25 pname = "cattrs"; 26 version = "23.2.3"; 27 format = "pyproject"; 28 29 disabled = pythonOlder "3.7"; 30 31 src = fetchFromGitHub { 32 owner = "python-attrs"; 33 repo = pname; 34 rev = "refs/tags/v${version}"; 35 hash = "sha256-zWM5zmZr2EiJb/4Dc6KjDL89p0C1V0Dsz949byz5OVM="; 36 }; 37 38 nativeBuildInputs = [ 39 hatchling 40 hatch-vcs 41 ]; 42 43 propagatedBuildInputs = 44 [ attrs ] 45 ++ lib.optionals (pythonOlder "3.11") [ 46 exceptiongroup 47 typing-extensions 48 ]; 49 50 nativeCheckInputs = [ 51 cbor2 52 hypothesis 53 immutables 54 motor 55 msgpack 56 orjson 57 pytest-xdist 58 pytestCheckHook 59 pyyaml 60 tomlkit 61 typing-extensions 62 ujson 63 ]; 64 65 postPatch = '' 66 substituteInPlace pyproject.toml \ 67 --replace "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" "" 68 substituteInPlace tests/test_preconf.py \ 69 --replace "from orjson import dumps as orjson_dumps" "" \ 70 --replace "from orjson import loads as orjson_loads" "" 71 ''; 72 73 preCheck = '' 74 export HOME=$(mktemp -d); 75 ''; 76 77 disabledTestPaths = [ 78 # Don't run benchmarking tests 79 "bench/test_attrs_collections.py" 80 "bench/test_attrs_nested.py" 81 "bench/test_attrs_primitives.py" 82 "bench/test_primitives.py" 83 ]; 84 85 disabledTests = [ 86 # orjson is not available as it requires Rust nightly features to compile its requirements 87 "test_orjson" 88 # tomlkit is pinned to an older version and newer versions raise InvalidControlChar exception 89 "test_tomlkit" 90 ]; 91 92 pythonImportsCheck = [ "cattr" ]; 93 94 meta = with lib; { 95 description = "Python custom class converters for attrs"; 96 homepage = "https://github.com/python-attrs/cattrs"; 97 changelog = "https://github.com/python-attrs/cattrs/blob/${src.rev}/HISTORY.md"; 98 license = with licenses; [ mit ]; 99 maintainers = with maintainers; [ fab ]; 100 }; 101}