1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, rustPlatform
5, stdenv
6, libiconv
7, brotli
8, lz4
9, memory_profiler
10, numpy
11, pytest-benchmark
12, pytestCheckHook
13, python-snappy
14, zstd
15}:
16
17buildPythonPackage rec {
18 pname = "cramjam";
19 version = "2.4.0";
20 format = "pyproject";
21
22 src = fetchFromGitHub {
23 owner = "milesgranger";
24 repo = "pyrus-cramjam";
25 rev = "v${version}";
26 sha256 = "sha256-00KvbiTf8PxYWljLKTRZmPIAbb+PnBleDM4p0AzZhHw=";
27 };
28
29 cargoDeps = rustPlatform.fetchCargoTarball {
30 inherit src;
31 sha256 = "sha256-4y/jeEZjVUbaXtBx5l3Hrbnj3iNYX089K4xexRP+5v0=";
32 };
33
34 nativeBuildInputs = with rustPlatform; [
35 cargoSetupHook
36 maturinBuildHook
37 ];
38 buildInputs = lib.optional stdenv.isDarwin libiconv;
39
40 checkInputs = [
41 brotli
42 lz4
43 memory_profiler
44 numpy
45 pytest-benchmark
46 pytestCheckHook
47 python-snappy
48 zstd
49 ];
50 pytestFlagsArray = [ "--benchmark-disable" ];
51 pythonImportsCheck = [ "cramjam" ];
52
53 meta = with lib; {
54 description = "Thin Python bindings to de/compression algorithms in Rust";
55 homepage = "https://github.com/milesgranger/pyrus-cramjam";
56 license = with licenses; [ mit ];
57 maintainers = with maintainers; [ veprbl ];
58 };
59}