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