depot/third_party/nixpkgs/pkgs/development/python-modules/orjson/default.nix

65 lines
1.2 KiB
Nix
Raw Normal View History

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