nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 94 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 rustPlatform, 9 cffi, 10 11 # native dependencies 12 libiconv, 13 14 # tests 15 numpy, 16 psutil, 17 pytestCheckHook, 18 python-dateutil, 19 pytz, 20 xxhash, 21 22 # for passthru.tests 23 falcon, 24 fastapi, 25 gradio, 26 mashumaro, 27 ufolib2, 28}: 29 30buildPythonPackage rec { 31 pname = "orjson"; 32 version = "3.11.5"; 33 pyproject = true; 34 35 src = fetchFromGitHub { 36 owner = "ijl"; 37 repo = "orjson"; 38 tag = version; 39 hash = "sha256-MWNAP8p4TN5yXFtXKWCyguv3EnFpZHMG8YEIiFF1Vug="; 40 }; 41 42 patches = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ 43 # fix architecture checks in build.rs to fix build for riscv 44 ./cross-arch-compat.patch 45 ]; 46 47 cargoDeps = rustPlatform.fetchCargoVendor { 48 inherit pname version src; 49 hash = "sha256-sRVa1cCbZQJq4bASn7oreEKpzTvuDoMzVs/IbojQa8s="; 50 }; 51 52 nativeBuildInputs = [ 53 cffi 54 ] 55 ++ (with rustPlatform; [ 56 cargoSetupHook 57 maturinBuildHook 58 ]); 59 60 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]; 61 62 nativeCheckInputs = [ 63 numpy 64 psutil 65 pytestCheckHook 66 python-dateutil 67 pytz 68 xxhash 69 ]; 70 71 pythonImportsCheck = [ "orjson" ]; 72 73 passthru.tests = { 74 inherit 75 falcon 76 fastapi 77 gradio 78 mashumaro 79 ufolib2 80 ; 81 }; 82 83 meta = { 84 description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"; 85 homepage = "https://github.com/ijl/orjson"; 86 changelog = "https://github.com/ijl/orjson/blob/${version}/CHANGELOG.md"; 87 license = with lib.licenses; [ 88 asl20 89 mit 90 ]; 91 platforms = lib.platforms.unix; 92 maintainers = with lib.maintainers; [ misuzu ]; 93 }; 94}