1{
2 lib,
3 buildPythonPackage,
4 rustPlatform,
5 fetchFromGitHub,
6 libiconv,
7 dirty-equals,
8 pytestCheckHook,
9 nix-update-script,
10}:
11
12buildPythonPackage rec {
13 pname = "jiter";
14 version = "0.8.2";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "pydantic";
19 repo = "jiter";
20 tag = "v${version}";
21 hash = "sha256-6FPwQ6t/zLB86k97S+6z5xWKBPJvjZ5/x3KrxOOT1gk=";
22 };
23
24 postPatch = ''
25 cp ${./Cargo.lock} Cargo.lock
26 '';
27
28 cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
29
30 buildAndTestSubdir = "crates/jiter-python";
31
32 nativeBuildInputs = [ rustPlatform.cargoSetupHook ];
33
34 build-system = [ rustPlatform.maturinBuildHook ];
35
36 buildInputs = [ libiconv ];
37
38 pythonImportsCheck = [ "jiter" ];
39
40 nativeCheckInputs = [
41 dirty-equals
42 pytestCheckHook
43 ];
44
45 passthru.updateScript = nix-update-script { extraArgs = [ "--generate-lockfile" ]; };
46
47 meta = {
48 description = "Fast iterable JSON parser";
49 homepage = "https://github.com/pydantic/jiter/";
50 changelog = "https://github.com/pydantic/jiter/releases/tag/v${version}";
51 license = lib.licenses.mit;
52 maintainers = with lib.maintainers; [ natsukium ];
53 };
54}