1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6 setuptools,
7 numpy,
8 pytestCheckHook,
9}:
10
11buildPythonPackage rec {
12 pname = "py3langid";
13 version = "0.3.0";
14 pyproject = true;
15
16 disabled = pythonOlder "3.6";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-CodaAxpYqvnb2nu4KF/XXoAae9J2IW/6vgN5AdS0Sew=";
21 };
22
23 nativeBuildInputs = [ setuptools ];
24
25 propagatedBuildInputs = [ numpy ];
26
27 nativeCheckInputs = [ pytestCheckHook ];
28
29 # nixify path to the courlan binary in the test suite
30 postPatch = ''
31 substituteInPlace tests/test_langid.py --replace "'langid'" "'$out/bin/langid'"
32 substituteInPlace pyproject.toml --replace-fail \
33 'numpy >= 2.0.0' numpy
34 '';
35
36 pythonImportsCheck = [ "py3langid" ];
37
38 meta = with lib; {
39 description = "Fork of the language identification tool langid.py, featuring a modernized codebase and faster execution times";
40 mainProgram = "langid";
41 homepage = "https://github.com/adbar/py3langid";
42 changelog = "https://github.com/adbar/py3langid/blob/v${version}/HISTORY.rst";
43 license = licenses.bsd3;
44 maintainers = with maintainers; [ jokatzke ];
45 };
46}