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