nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cargo,
6 libiconv,
7 fetchFromGitHub,
8 json-stream,
9 json-stream-rs-tokenizer,
10 rustc,
11 rustPlatform,
12 setuptools,
13 setuptools-rust,
14 wheel,
15}:
16
17buildPythonPackage rec {
18 pname = "json-stream-rs-tokenizer";
19 version = "0.4.32";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "smheidrich";
24 repo = "py-json-stream-rs-tokenizer";
25 tag = "v${version}";
26 hash = "sha256-J68feE7C4I0zHmRjop7Pexx2ApkzUefz/lokYTINSiI=";
27 };
28
29 cargoDeps = rustPlatform.fetchCargoVendor {
30 inherit pname version src;
31 hash = "sha256-IPQrqayhyQ/gmT6nK+TgDcUQ4mPrG9yiJJk6enBzybA=";
32 };
33
34 nativeBuildInputs = [
35 cargo
36 rustPlatform.cargoSetupHook
37 rustc
38 setuptools
39 setuptools-rust
40 wheel
41 ];
42
43 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
44
45 # Tests depend on json-stream, which depends on this package.
46 # To avoid infinite recursion, we only enable tests when building passthru.tests.
47 doCheck = false;
48
49 checkInputs = [ json-stream ];
50
51 pythonImportsCheck = [ "json_stream_rs_tokenizer" ];
52
53 passthru.tests = {
54 runTests = json-stream-rs-tokenizer.overrideAttrs (_: {
55 doCheck = true;
56 });
57 };
58
59 meta = {
60 description = "Faster tokenizer for the json-stream Python library";
61 homepage = "https://github.com/smheidrich/py-json-stream-rs-tokenizer";
62 license = lib.licenses.mit;
63 maintainers = with lib.maintainers; [ winter ];
64 };
65}