summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/marisa-trie/default.nix
blob: e47cbef202910dac0c538a908dc6d49d15b131d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  replaceVars,
  marisa-cpp,
  cython,
  setuptools,
  pytestCheckHook,
  hypothesis,
}:

buildPythonPackage rec {
  pname = "marisa-trie";
  version = "1.3.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pytries";
    repo = "marisa-trie";
    tag = version;
    hash = "sha256-7T0V5levh9xjWmjJdFix0p8L3lZhfurikSWMI7Hotbs=";
  };

  patches = [
    (replaceVars ./unvendor-marisa.patch {
      marisa = lib.getDev marisa-cpp;
    })
  ];

  build-system = [
    cython
    setuptools
  ];

  buildInputs = [
    marisa-cpp
  ];

  nativeCheckInputs = [
    pytestCheckHook
    hypothesis
  ];

  disabledTestPaths = [
    # Don't test packaging
    "tests/test_packaging.py"
  ];

  pythonImportsCheck = [ "marisa_trie" ];

  meta = {
    description = "Static memory-efficient Trie-like structures for Python based on marisa-trie C++ library";
    longDescription = ''
      There are official SWIG-based Python bindings included in C++ library distribution.
      This package provides alternative Cython-based pip-installable Python bindings.
    '';
    homepage = "https://github.com/kmike/marisa-trie";
    changelog = "https://github.com/pytries/marisa-trie/blob/${src.tag}/CHANGES.rst";
    license = lib.licenses.mit;
  };
}