1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 rustPlatform,
6 stdenv,
7 libiconv,
8 hypothesis,
9 numpy,
10 pytest-xdist,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "cramjam";
16 version = "2.8.3";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "milesgranger";
21 repo = "pyrus-cramjam";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-1KD5/oZjfdXav1ZByQoyyiDSzbmY4VJsSJg/FtUFdDE=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoTarball {
27 inherit src;
28 hash = "sha256-Bp7EtyuLdLUfU3yvouNVE42klfqYt9QOwt+iGe521yI=";
29 };
30
31 buildAndTestSubdir = "cramjam-python";
32
33 nativeBuildInputs = with rustPlatform; [
34 cargoSetupHook
35 maturinBuildHook
36 ];
37
38 buildInputs = lib.optional stdenv.isDarwin libiconv;
39
40 nativeCheckInputs = [
41 hypothesis
42 numpy
43 pytest-xdist
44 pytestCheckHook
45 ];
46
47 pytestFlagsArray = [ "cramjam-python/tests" ];
48
49 disabledTestPaths = [
50 "cramjam-python/benchmarks/test_bench.py"
51 # test_variants.py appears to be flaky
52 #
53 # https://github.com/NixOS/nixpkgs/pull/311584#issuecomment-2117656380
54 "cramjam-python/tests/test_variants.py"
55 ];
56
57 pythonImportsCheck = [ "cramjam" ];
58
59 meta = with lib; {
60 description = "Thin Python bindings to de/compression algorithms in Rust";
61 homepage = "https://github.com/milesgranger/pyrus-cramjam";
62 license = with licenses; [ mit ];
63 maintainers = with maintainers; [ veprbl ];
64 };
65}