depot/third_party/nixpkgs/pkgs/development/python-modules/orjson/default.nix
Default email 94427deb9d Project import generated by Copybara.
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
2023-05-24 16:37:59 +03:00

69 lines
1.3 KiB
Nix

{ lib
, stdenv
, pythonOlder
, rustPlatform
, fetchFromGitHub
, buildPythonPackage
, cffi
, libiconv
, numpy
, psutil
, pytestCheckHook
, python-dateutil
, pytz
, xxhash
}:
buildPythonPackage rec {
pname = "orjson";
version = "3.8.11";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "ijl";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-TFoagWUtd/nJceNaptgPp4aTR/tBCmxpiZIVJwOlia4=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
hash = "sha256-/x+0/I3WFxPwVu2LliTgr42SuJX7VjOLe/SGai5OgAw=";
};
nativeBuildInputs = [
cffi
] ++ (with rustPlatform; [
cargoSetupHook
maturinBuildHook
]);
buildInputs = lib.optionals stdenv.isDarwin [
libiconv
];
nativeCheckInputs = [
numpy
psutil
pytestCheckHook
python-dateutil
pytz
xxhash
];
pythonImportsCheck = [
"orjson"
];
meta = with lib; {
description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy";
homepage = "https://github.com/ijl/orjson";
changelog = "https://github.com/ijl/orjson/blob/${version}/CHANGELOG.md";
license = with licenses; [ asl20 mit ];
platforms = platforms.unix;
maintainers = with maintainers; [ misuzu ];
};
}