1{ lib
2, fetchFromGitHub
3, pythonOlder
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.3.0";
17 format = "setuptools";
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "polm";
22 repo = "fugashi";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-4i7Q+TtXTQNSJ1EIcS8KHrVPdCJAgZh86Y6lB8772XU=";
25 };
26
27 SETUPTOOLS_SCM_PRETEND_VERSION = version;
28
29 nativeBuildInputs = [ cython mecab setuptools-scm ];
30
31 nativeCheckInputs = [ ipadic pytestCheckHook ]
32 ++ passthru.optional-dependencies.unidic-lite;
33
34 passthru.optional-dependencies = {
35 unidic-lite = [ unidic-lite ];
36 unidic = [ unidic ];
37 };
38
39 preCheck = ''
40 cd fugashi
41 '';
42
43 pythonImportsCheck = [ "fugashi" ];
44
45 meta = with lib; {
46 description = "A Cython MeCab wrapper for fast, pythonic Japanese tokenization and morphological analysis";
47 homepage = "https://github.com/polm/fugashi";
48 changelog = "https://github.com/polm/fugashi/releases/tag/${version}";
49 license = licenses.mit;
50 maintainers = with maintainers; [ laurent-f1z1 ];
51 };
52}