nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 = "1.0.3";
17
18 pyproject = true;
19
20 src = fetchPypi {
21 inherit version;
22 pname = "ahocorasick_rs";
23 hash = "sha256-V503Bwp8Idqc2ZiLn7RxKXJztgy0EmWG1tzZn6r8XKU=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoVendor {
27 inherit pname version src;
28 hash = "sha256-RfgjO0qffiAZynQ/xChd81L8S0sqTGdWvpHPrz3bKlQ=";
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 = {
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 = lib.licenses.asl20;
54 maintainers = with lib.maintainers; [ erictapen ];
55 };
56
57}