at 23.11-beta 1.3 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.9.10"; 20 format = "pyproject"; 21 22 disabled = pythonOlder "3.7"; 23 24 src = fetchFromGitHub { 25 owner = "ijl"; 26 repo = pname; 27 rev = "refs/tags/${version}"; 28 hash = "sha256-MkcuayNDt7/GcswXoFTvzuaZzhQEQV+V7OfKqgJwVIQ="; 29 }; 30 31 cargoDeps = rustPlatform.fetchCargoTarball { 32 inherit src; 33 name = "${pname}-${version}"; 34 hash = "sha256-2eRV+oZQvsWWJ4AUTeuE0CHtTHC6jNZiX/y5uXuwvns="; 35 }; 36 37 nativeBuildInputs = [ 38 cffi 39 ] ++ (with rustPlatform; [ 40 cargoSetupHook 41 maturinBuildHook 42 ]); 43 44 buildInputs = lib.optionals stdenv.isDarwin [ 45 libiconv 46 ]; 47 48 nativeCheckInputs = [ 49 numpy 50 psutil 51 pytestCheckHook 52 python-dateutil 53 pytz 54 xxhash 55 ]; 56 57 pythonImportsCheck = [ 58 "orjson" 59 ]; 60 61 meta = with lib; { 62 description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"; 63 homepage = "https://github.com/ijl/orjson"; 64 changelog = "https://github.com/ijl/orjson/blob/${version}/CHANGELOG.md"; 65 license = with licenses; [ asl20 mit ]; 66 platforms = platforms.unix; 67 maintainers = with maintainers; [ misuzu ]; 68 }; 69}