1{ lib 2, stdenv 3, buildPythonPackage 4, cargo 5, darwin 6, fetchFromGitHub 7, json-stream 8, json-stream-rs-tokenizer 9, rustc 10, rustPlatform 11, setuptools 12, setuptools-rust 13, wheel 14}: 15 16buildPythonPackage rec { 17 pname = "json-stream-rs-tokenizer"; 18 version = "0.4.22"; 19 format = "setuptools"; 20 21 src = fetchFromGitHub { 22 owner = "smheidrich"; 23 repo = "py-json-stream-rs-tokenizer"; 24 rev = "refs/tags/v${version}"; 25 hash = "sha256-EW726gUXTBX3gTxlFQ45RgkUa2Z4tIjUZxO4GBLXgEs="; 26 }; 27 28 cargoDeps = rustPlatform.importCargoLock { 29 lockFile = ./Cargo.lock; 30 outputHashes = { 31 "utf8-read-0.4.0" = "sha256-L/NcgbB+2Rwtc+1e39fQh1D9S4RqQY6CCFOTh8CI8Ts="; 32 }; 33 }; 34 35 nativeBuildInputs = [ 36 cargo 37 rustPlatform.cargoSetupHook 38 rustc 39 setuptools 40 setuptools-rust 41 wheel 42 ]; 43 44 buildInputs = lib.optionals stdenv.isDarwin [ 45 darwin.libiconv 46 ]; 47 48 # Tests depend on json-stream, which depends on this package. 49 # To avoid infinite recursion, we only enable tests when building passthru.tests. 50 doCheck = false; 51 52 checkInputs = [ 53 json-stream 54 ]; 55 56 pythonImportsCheck = [ 57 "json_stream_rs_tokenizer" 58 ]; 59 60 passthru.tests = { 61 runTests = json-stream-rs-tokenizer.overrideAttrs (_: { doCheck = true; }); 62 }; 63 64 meta = with lib; { 65 description = "A faster tokenizer for the json-stream Python library"; 66 homepage = "https://github.com/smheidrich/py-json-stream-rs-tokenizer"; 67 license = licenses.mit; 68 maintainers = with maintainers; [ winter ]; 69 }; 70}