1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 rustPlatform,
6
7 # tests
8 hypothesis,
9 numpy,
10 pytest-xdist,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "cramjam";
16 version = "2.11.0.post1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "milesgranger";
21 repo = "cramjam";
22 tag = "v${version}";
23 hash = "sha256-iYx/cPQpZVVPAH+HTiYH/E9tmdnHvKf3Cel4yZpXSIA=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoVendor {
27 inherit pname src version;
28 hash = "sha256-jLGCyrVHtauWhiDghtYgt5MhgOl8wNiM7TAQhrCk2xU=";
29 };
30
31 nativeBuildInputs = with rustPlatform; [
32 cargoSetupHook
33 maturinBuildHook
34 ];
35
36 nativeCheckInputs = [
37 hypothesis
38 numpy
39 pytest-xdist
40 pytestCheckHook
41 ];
42
43 env = {
44 # Makes tests less flaky by relaxing performance constraints
45 # https://github.com/HypothesisWorks/hypothesis/issues/3713
46 CI = true;
47 };
48
49 disabledTests = [
50 # I (@GaetanLepage) cannot reproduce the failure, but it fails consistently on Ofborg with:
51 # SyntaxError: could not convert string to float: 'V' - Consider hexadecimal for huge integer literals to avoid decimal conversion limits.
52 "test_variants_decompress_into"
53 ];
54
55 disabledTestPaths = [
56 "benchmarks/test_bench.py"
57 ];
58
59 pythonImportsCheck = [ "cramjam" ];
60
61 meta = {
62 description = "Thin Python bindings to de/compression algorithms in Rust";
63 homepage = "https://github.com/milesgranger/pyrus-cramjam";
64 changelog = "https://github.com/milesgranger/cramjam/releases/tag/v${version}";
65 license = with lib.licenses; [ mit ];
66 maintainers = with lib.maintainers; [ veprbl ];
67 };
68}