Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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.2";
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "ijl";
24 repo = pname;
25 rev = version;
26 hash = "sha256-jiyYCjZ6c62zmm4Ge9KbEI8/PtPunu79HVODyoHFdSg=";
27 };
28
29 cargoDeps = rustPlatform.fetchCargoTarball {
30 inherit src;
31 name = "${pname}-${version}";
32 hash = "sha256-z1B0oSp37OGJ21Q57UUfmSRfUWLftiiBayN9y6yKNyg=";
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 pythonImportsCheck = [ pname ];
56
57 meta = with lib; {
58 description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy";
59 homepage = "https://github.com/ijl/orjson";
60 license = with licenses; [ asl20 mit ];
61 platforms = platforms.unix;
62 maintainers = with maintainers; [ misuzu ];
63 };
64}