at 23.05-pre 1.4 kB view raw
1{ lib 2, stdenv 3, pythonOlder 4, rustPlatform 5, fetchFromGitHub 6, buildPythonPackage 7, cffi 8, libiconv 9, numpy 10, psutil 11, pytestCheckHook 12, python-dateutil 13, pytz 14, xxhash 15}: 16 17buildPythonPackage rec { 18 pname = "orjson"; 19 version = "3.8.1"; 20 disabled = pythonOlder "3.7"; 21 22 src = fetchFromGitHub { 23 owner = "ijl"; 24 repo = pname; 25 rev = version; 26 hash = "sha256-3U27JuKMsMla3BKbbpO0uXesGHYaVQs8MwtQvumkksY="; 27 }; 28 29 cargoDeps = rustPlatform.fetchCargoTarball { 30 inherit src; 31 name = "${pname}-${version}"; 32 hash = "sha256-QXguyDxQHW9Fd3Nhmi5JzSxZQuk3HGPhhh/RGuOTZNY"; 33 }; 34 35 format = "pyproject"; 36 37 nativeBuildInputs = [ 38 cffi 39 ] ++ (with rustPlatform; [ 40 cargoSetupHook 41 maturinBuildHook 42 ]); 43 44 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]; 45 46 checkInputs = [ 47 numpy 48 psutil 49 pytestCheckHook 50 python-dateutil 51 pytz 52 xxhash 53 ]; 54 55 disabledTests = lib.optionals (stdenv.is32bit) [ 56 # integer overflow on 32bit 57 "test_numpy_array_d1_intp" 58 "test_numpy_array_d1_uintp" 59 ]; 60 61 pythonImportsCheck = [ pname ]; 62 63 meta = with lib; { 64 description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"; 65 homepage = "https://github.com/ijl/orjson"; 66 license = with licenses; [ asl20 mit ]; 67 platforms = platforms.unix; 68 maintainers = with maintainers; [ misuzu ]; 69 }; 70}