1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, rustPlatform
5, stdenv
6, libiconv
7, brotli
8, hypothesis
9, lz4
10, memory-profiler
11, numpy
12, py
13, pytest-benchmark
14, pytestCheckHook
15, python-snappy
16, zstd
17}:
18
19buildPythonPackage rec {
20 pname = "cramjam";
21 version = "2.6.2.post1";
22 format = "pyproject";
23
24 src = fetchFromGitHub {
25 owner = "milesgranger";
26 repo = "pyrus-cramjam";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-KU1JVNEQJadXNiIWTvI33N2NSq994xoKxcAGGezFjaI=";
29 };
30
31 cargoDeps = rustPlatform.fetchCargoTarball {
32 inherit src;
33 hash = "sha256-w1bEf+etLgR/YOyLmC3lFtO9fqAx8z2aul/XIKUQb5k=";
34 };
35
36 nativeBuildInputs = with rustPlatform; [
37 cargoSetupHook
38 maturinBuildHook
39 ];
40
41 buildInputs = lib.optional stdenv.isDarwin libiconv;
42
43 nativeCheckInputs = [
44 brotli
45 hypothesis
46 lz4
47 memory-profiler
48 numpy
49 py
50 pytest-benchmark
51 pytestCheckHook
52 python-snappy
53 zstd
54 ];
55
56 pytestFlagsArray = [
57 "--benchmark-disable"
58 ];
59
60 disabledTestPaths = [
61 "benchmarks/test_bench.py"
62 ];
63
64 pythonImportsCheck = [
65 "cramjam"
66 ];
67
68 meta = with lib; {
69 description = "Thin Python bindings to de/compression algorithms in Rust";
70 homepage = "https://github.com/milesgranger/pyrus-cramjam";
71 license = with licenses; [ mit ];
72 maintainers = with maintainers; [ veprbl ];
73 };
74}