1{
2 lib,
3 fetchFromGitHub,
4 pytestCheckHook,
5 buildPythonPackage,
6 cython,
7 mecab,
8 setuptools-scm,
9 ipadic,
10 unidic,
11 unidic-lite,
12}:
13
14buildPythonPackage rec {
15 pname = "fugashi";
16 version = "1.5.1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "polm";
21 repo = "fugashi";
22 tag = "v${version}";
23 hash = "sha256-rkQskRz7lgVBrqBeyj9kWO2/7POrZ0TaM+Z7mhpZLvM=";
24 };
25
26 postPatch = ''
27 substituteInPlace pyproject.toml \
28 --replace-fail "Cython~=3.0.11" "Cython"
29 '';
30
31 build-system = [
32 cython
33 mecab
34 setuptools-scm
35 ];
36
37 nativeCheckInputs = [
38 ipadic
39 pytestCheckHook
40 ]
41 ++ optional-dependencies.unidic-lite;
42
43 optional-dependencies = {
44 unidic-lite = [ unidic-lite ];
45 unidic = [ unidic ];
46 };
47
48 preCheck = ''
49 cd fugashi
50 '';
51
52 pythonImportsCheck = [ "fugashi" ];
53
54 meta = with lib; {
55 description = "Cython MeCab wrapper for fast, pythonic Japanese tokenization and morphological analysis";
56 homepage = "https://github.com/polm/fugashi";
57 changelog = "https://github.com/polm/fugashi/releases/tag/${src.tag}";
58 license = licenses.mit;
59 maintainers = with maintainers; [ laurent-f1z1 ];
60 };
61}