1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchPypi, 6 rustPlatform, 7 pytestCheckHook, 8 pyahocorasick, 9 hypothesis, 10 typing-extensions, 11 pytest-benchmark, 12}: 13 14buildPythonPackage rec { 15 pname = "ahocorasick-rs"; 16 version = "0.22.2"; 17 18 pyproject = true; 19 20 src = fetchPypi { 21 inherit version; 22 pname = "ahocorasick_rs"; 23 hash = "sha256-h/J6ZCLb+U7A+f6ErAGI1KZrXHsvX23rFl8MXj25dpw="; 24 }; 25 26 cargoDeps = rustPlatform.fetchCargoVendor { 27 inherit pname version src; 28 hash = "sha256-uB3r6+Ewpi4dVke/TsCZltfc+ZABYLOLKuNxw+Jfu/M="; 29 }; 30 31 nativeBuildInputs = with rustPlatform; [ 32 maturinBuildHook 33 cargoSetupHook 34 ]; 35 36 dependencies = lib.optionals (pythonOlder "3.12") [ typing-extensions ]; 37 38 nativeCheckInputs = [ 39 pytest-benchmark 40 pytestCheckHook 41 pyahocorasick 42 hypothesis 43 ]; 44 45 pytestFlags = [ "--benchmark-disable" ]; 46 47 pythonImportsCheck = [ "ahocorasick_rs" ]; 48 49 meta = with lib; { 50 description = "Fast Aho-Corasick algorithm for Python"; 51 homepage = "https://github.com/G-Research/ahocorasick_rs/"; 52 changelog = "https://github.com/G-Research/ahocorasick_rs/blob/${version}/CHANGELOG.md"; 53 license = licenses.asl20; 54 maintainers = with maintainers; [ erictapen ]; 55 }; 56 57}