From 13bc6217b95036579018fb747a480f9f2921de94 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 26 Sep 2024 23:44:51 +0200 Subject: python312Packages.cltk: modernize and fix build --- pkgs/development/python-modules/cltk/default.nix | 83 ++++++++++++++++-------- 1 file changed, 55 insertions(+), 28 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/python-modules/cltk/default.nix b/pkgs/development/python-modules/cltk/default.nix index c1f88ddfa3267..7635ace28648e 100644 --- a/pkgs/development/python-modules/cltk/default.nix +++ b/pkgs/development/python-modules/cltk/default.nix @@ -1,31 +1,42 @@ { - buildPythonPackage, lib, - fetchPypi, - gitpython, - gensim, - tqdm, - torch, - stringcase, - stanza, - spacy, - scipy, - scikit-learn, - requests, - rapidfuzz, - pyyaml, - nltk, - boltons, + buildPythonPackage, + fetchFromGitHub, + + # build-system poetry-core, + + # dependencies + boltons, + gensim, + gitpython, greek-accentuation, + nltk, + pyyaml, + rapidfuzz, + requests, + scikit-learn, + scipy, + spacy, + stanza, + stringcase, + torch, + tqdm, + + # tests + pytestCheckHook, }: buildPythonPackage rec { pname = "cltk"; - format = "pyproject"; version = "1.3.0"; - src = fetchPypi { - inherit pname version; - hash = "sha256-jAxvToUIo333HSVQDYVyUBY3YP+m1RnlNGelcvktp6s="; + + pyproject = true; + + src = fetchFromGitHub { + owner = "cltk"; + repo = "cltk"; + rev = "refs/tags/v${version}"; + hash = "sha256-/rdv96lnSGN+aJJmPSIan79zoXxnStokFEAjBtCLKy4="; }; postPatch = '' @@ -36,13 +47,19 @@ buildPythonPackage rec { --replace-fail 'boltons = "^21.0.0"' 'boltons = "^24.0.0"' ''; - propagatedBuildInputs = [ - gitpython - gensim + build-system = [ poetry-core ]; + + pythonRelaxDeps = [ + "spacy" + ]; + + dependencies = [ boltons + gensim + gitpython greek-accentuation - pyyaml nltk + pyyaml rapidfuzz requests scikit-learn @@ -54,12 +71,22 @@ buildPythonPackage rec { tqdm ]; - nativeBuildInputs = [ poetry-core ]; + nativeCheckInputs = [ + pytestCheckHook + ]; + + preCheck = '' + export HOME=$(mktemp -d) + ''; + + # Most of tests fail as they require local files to be present and also internet access + doCheck = false; - meta = with lib; { + meta = { description = "Natural language processing (NLP) framework for pre-modern languages"; homepage = "https://cltk.org"; - license = licenses.mit; - maintainers = with maintainers; [ kmein ]; + changelog = "https://github.com/cltk/cltk/releases/tag/v${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kmein ]; }; } -- cgit 1.4.1