1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 replaceVars,
6 marisa-cpp,
7 cython,
8 setuptools,
9 pytestCheckHook,
10 hypothesis,
11}:
12
13buildPythonPackage rec {
14 pname = "marisa-trie";
15 version = "1.2.1";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "pytries";
20 repo = "marisa-trie";
21 tag = version;
22 hash = "sha256-aWfm13nrASAaD+bcMpv85emXnCFyVtZTdhl79yJuOss=";
23 };
24
25 patches = [
26 (replaceVars ./unvendor-marisa.patch {
27 marisa = lib.getDev marisa-cpp;
28 })
29 ];
30
31 build-system = [
32 cython
33 setuptools
34 ];
35
36 buildInputs = [
37 marisa-cpp
38 ];
39
40 nativeCheckInputs = [
41 pytestCheckHook
42 hypothesis
43 ];
44
45 preBuild = ''
46 ./update_cpp.sh
47 '';
48
49 disabledTestPaths = [
50 # Don't test packaging
51 "tests/test_packaging.py"
52 ];
53
54 pythonImportsCheck = [ "marisa_trie" ];
55
56 meta = with lib; {
57 description = "Static memory-efficient Trie-like structures for Python based on marisa-trie C++ library";
58 longDescription = ''
59 There are official SWIG-based Python bindings included in C++ library distribution.
60 This package provides alternative Cython-based pip-installable Python bindings.
61 '';
62 homepage = "https://github.com/kmike/marisa-trie";
63 changelog = "https://github.com/pytries/marisa-trie/blob/${src.tag}/CHANGES.rst";
64 license = licenses.mit;
65 };
66}