1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6
7 pythonOlder,
8
9 pytestCheckHook,
10
11 setuptools,
12
13 # for testing
14 numpy,
15 importlib-resources,
16
17 # requirements
18 editdistpy,
19}:
20
21buildPythonPackage rec {
22 pname = "symspellpy";
23 version = "6.7.7";
24 pyproject = true;
25
26 disabled = pythonOlder "3.8";
27
28 patches = [
29 # patch for fix tests
30 # https://github.com/mammothb/symspellpy/pull/151
31 (fetchpatch {
32 name = "fix-pkg-resources-deprecation-warning.patch";
33 url = "https://github.com/mammothb/symspellpy/commit/b0298f4936f28a79612f5509612210868548793f.patch";
34 hash = "sha256-mdUJMrcPv5zczIRP+8u5vicz2IE1AUN3YP0+zg3jqZg=";
35 })
36 (fetchpatch {
37 name = "fix-error-message-checking-py312.patch";
38 url = "https://github.com/mammothb/symspellpy/commit/f6f91e18316bed717036306c33d2ee82a922563a.patch";
39 hash = "sha256-a5KsESIEIzlbcEPq8sTB2+XkuT/vP81U8StZhaL0MbA=";
40 })
41 ];
42
43 src = fetchFromGitHub {
44 owner = "mammothb";
45 repo = "symspellpy";
46 rev = "refs/tags/v${version}";
47 hash = "sha256-D8xdMCy4fSff3nuS2sD2QHWk0869AlFDE+lFRvayYDQ=";
48 };
49
50 build-system = [ setuptools ];
51
52 dependencies = [ editdistpy ];
53
54 nativeCheckInputs = [
55 pytestCheckHook
56 numpy
57 importlib-resources
58 ];
59
60 pythonImportsCheck = [
61 "symspellpy"
62 "symspellpy.symspellpy"
63 ];
64
65 meta = with lib; {
66 description = "Python port of SymSpell v6.7.1, which provides much higher speed and lower memory consumption";
67 homepage = "https://github.com/mammothb/symspellpy";
68 changelog = "https://github.com/mammothb/symspellpy/releases/tag/v${version}";
69 license = licenses.mit;
70 maintainers = with maintainers; [ vizid ];
71 };
72}