nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 setuptools,
6 numpy,
7 pytestCheckHook,
8}:
9
10buildPythonPackage rec {
11 pname = "py3langid";
12 version = "0.3.0";
13 pyproject = true;
14
15 src = fetchPypi {
16 inherit pname version;
17 hash = "sha256-CodaAxpYqvnb2nu4KF/XXoAae9J2IW/6vgN5AdS0Sew=";
18 };
19
20 nativeBuildInputs = [ setuptools ];
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 substituteInPlace pyproject.toml --replace-fail \
30 'numpy >= 2.0.0' numpy
31 '';
32
33 pythonImportsCheck = [ "py3langid" ];
34
35 meta = {
36 description = "Fork of the language identification tool langid.py, featuring a modernized codebase and faster execution times";
37 mainProgram = "langid";
38 homepage = "https://github.com/adbar/py3langid";
39 changelog = "https://github.com/adbar/py3langid/blob/v${version}/HISTORY.rst";
40 license = lib.licenses.bsd3;
41 maintainers = with lib.maintainers; [ jokatzke ];
42 };
43}