2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
cargo,
|
|
|
|
libiconv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
json-stream,
|
|
|
|
json-stream-rs-tokenizer,
|
|
|
|
pythonOlder,
|
|
|
|
rustc,
|
|
|
|
rustPlatform,
|
|
|
|
setuptools,
|
|
|
|
setuptools-rust,
|
|
|
|
wheel,
|
2023-03-15 16:39:30 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "json-stream-rs-tokenizer";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.4.26";
|
2024-02-07 01:22:34 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "smheidrich";
|
|
|
|
repo = "py-json-stream-rs-tokenizer";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-ogX0KsfHRQW7+exRMKGwJiNINrOKPiTKxAqiTZyEWrg=";
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"utf8-read-0.4.0" = "sha256-L/NcgbB+2Rwtc+1e39fQh1D9S4RqQY6CCFOTh8CI8Ts=";
|
|
|
|
};
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-05-24 13:37:59 +00:00
|
|
|
cargo
|
2023-08-22 20:05:09 +00:00
|
|
|
rustPlatform.cargoSetupHook
|
2023-05-24 13:37:59 +00:00
|
|
|
rustc
|
2023-08-22 20:05:09 +00:00
|
|
|
setuptools
|
|
|
|
setuptools-rust
|
|
|
|
wheel
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
# Tests depend on json-stream, which depends on this package.
|
|
|
|
# To avoid infinite recursion, we only enable tests when building passthru.tests.
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
checkInputs = [ json-stream ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "json_stream_rs_tokenizer" ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
passthru.tests = {
|
2024-06-05 15:53:02 +00:00
|
|
|
runTests = json-stream-rs-tokenizer.overrideAttrs (_: {
|
|
|
|
doCheck = true;
|
|
|
|
});
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Faster tokenizer for the json-stream Python library";
|
2023-03-15 16:39:30 +00:00
|
|
|
homepage = "https://github.com/smheidrich/py-json-stream-rs-tokenizer";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ winter ];
|
|
|
|
};
|
|
|
|
}
|