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