1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 cython,
6 setuptools,
7 pytestCheckHook,
8 hypothesis,
9 readme-renderer,
10 pythonOlder,
11}:
12
13buildPythonPackage rec {
14 pname = "marisa-trie";
15 version = "1.2.1";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 pname = "marisa_trie";
22 inherit version;
23 hash = "sha256-OifECOKu/APg8dJbL/KvuFqsNWj2+iripTtXouh84p0=";
24 };
25
26 build-system = [
27 cython
28 setuptools
29 ];
30
31 nativeCheckInputs = [
32 pytestCheckHook
33 readme-renderer
34 hypothesis
35 ];
36
37 postPatch = ''
38 substituteInPlace setup.py \
39 --replace "hypothesis==" "hypothesis>="
40 '';
41
42 preBuild = ''
43 ./update_cpp.sh
44 '';
45
46 disabledTestPaths = [
47 # Don't test packaging
48 "tests/test_packaging.py"
49 ];
50
51 disabledTests = [
52 # Pins hypothesis==2.0.0 from 2016/01 which complains about
53 # hypothesis.errors.FailedHealthCheck: tests/test_trie.py::[...] uses
54 # the 'tmpdir' fixture, which is reset between function calls but not
55 # between test cases generated by `@given(...)`.
56 "test_saveload"
57 "test_mmap"
58 ];
59
60 pythonImportsCheck = [ "marisa_trie" ];
61
62 meta = with lib; {
63 description = "Static memory-efficient Trie-like structures for Python based on marisa-trie C++ library";
64 longDescription = ''
65 There are official SWIG-based Python bindings included in C++ library distribution.
66 This package provides alternative Cython-based pip-installable Python bindings.
67 '';
68 homepage = "https://github.com/kmike/marisa-trie";
69 changelog = "https://github.com/pytries/marisa-trie/blob/${version}/CHANGES.rst";
70 license = licenses.mit;
71 };
72}