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