2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
rustPlatform,
|
|
|
|
cffi,
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# native dependencies
|
|
|
|
libiconv,
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
numpy,
|
|
|
|
psutil,
|
|
|
|
pytestCheckHook,
|
|
|
|
python-dateutil,
|
|
|
|
pytz,
|
|
|
|
xxhash,
|
|
|
|
python,
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# for passthru.tests
|
|
|
|
falcon,
|
|
|
|
fastapi,
|
|
|
|
gradio,
|
|
|
|
mashumaro,
|
|
|
|
ufolib2,
|
2021-09-22 15:38:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "orjson";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "3.10.3";
|
2024-02-29 20:09:43 +00:00
|
|
|
pyproject = true;
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2021-09-22 15:38:15 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ijl";
|
2024-02-29 20:09:43 +00:00
|
|
|
repo = "orjson";
|
2023-03-15 16:39:30 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-bK6wA8P/IXEbiuJAx7psd0nUUKjR1jX4scFfJr1MBAk=";
|
2021-09-22 15:38:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-ilGq+/gPSuNwURUWy2ZxInzmUv+PxYMxd8esxrMpr2o=";
|
2021-09-22 15:38:15 +00:00
|
|
|
};
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
maturinBuildFlags = [ "--interpreter ${python.executable}" ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs =
|
|
|
|
[ cffi ]
|
|
|
|
++ (with rustPlatform; [
|
|
|
|
cargoSetupHook
|
|
|
|
maturinBuildHook
|
|
|
|
]);
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-09-22 15:38:15 +00:00
|
|
|
numpy
|
|
|
|
psutil
|
|
|
|
pytestCheckHook
|
|
|
|
python-dateutil
|
|
|
|
pytz
|
|
|
|
xxhash
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "orjson" ];
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit
|
|
|
|
falcon
|
|
|
|
fastapi
|
|
|
|
gradio
|
|
|
|
mashumaro
|
|
|
|
ufolib2
|
2024-06-05 15:53:02 +00:00
|
|
|
;
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy";
|
|
|
|
homepage = "https://github.com/ijl/orjson";
|
2023-02-02 18:25:31 +00:00
|
|
|
changelog = "https://github.com/ijl/orjson/blob/${version}/CHANGELOG.md";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = with licenses; [
|
|
|
|
asl20
|
|
|
|
mit
|
|
|
|
];
|
2021-09-22 15:38:15 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ misuzu ];
|
|
|
|
};
|
|
|
|
}
|