1{ lib
2, stdenv
3, pythonOlder
4, rustPlatform
5, fetchFromGitHub
6, buildPythonPackage
7, libiconv
8, numpy
9, psutil
10, pytestCheckHook
11, python-dateutil
12, pytz
13, xxhash
14}:
15
16buildPythonPackage rec {
17 pname = "orjson";
18 version = "3.6.4";
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "ijl";
23 repo = pname;
24 rev = version;
25 sha256 = "0xpna70s5v7d4lwsb6ijc0f2rm6p7jqmac9yayx9qb1dasbki6zd";
26 };
27
28 cargoDeps = rustPlatform.fetchCargoTarball {
29 inherit src;
30 name = "${pname}-${version}";
31 sha256 = "0m4f8lc0zwxh4lmxkpxvdd2lc2g3lkq0ymllqbyr31sbxvwnxk56";
32 };
33
34 format = "pyproject";
35
36 nativeBuildInputs = with rustPlatform; [
37 cargoSetupHook
38 maturinBuildHook
39 ];
40
41 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
42
43 checkInputs = [
44 numpy
45 psutil
46 pytestCheckHook
47 python-dateutil
48 pytz
49 xxhash
50 ];
51
52 pythonImportsCheck = [ pname ];
53
54 meta = with lib; {
55 description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy";
56 homepage = "https://github.com/ijl/orjson";
57 license = with licenses; [ asl20 mit ];
58 platforms = platforms.unix;
59 maintainers = with maintainers; [ misuzu ];
60 };
61}