From addbb0edd29c948ffebfc7f1636b975c0e39b6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 26 Aug 2024 00:09:02 +0200 Subject: [PATCH] python312Packages.llama-index-core: use nltk-data from nix package This also doesn't fetch the tip of branch which is not reproducible --- .../llama-index-core/default.nix | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/pkgs/development/python-modules/llama-index-core/default.nix b/pkgs/development/python-modules/llama-index-core/default.nix index f6dab9b1f0fb..85ad5d57d8f6 100644 --- a/pkgs/development/python-modules/llama-index-core/default.nix +++ b/pkgs/development/python-modules/llama-index-core/default.nix @@ -6,13 +6,13 @@ deprecated, dirtyjson, fetchFromGitHub, - fetchzip, fsspec, jsonpath-ng, llamaindex-py-client, nest-asyncio, networkx, nltk, + nltk-data, numpy, openai, pandas, @@ -33,18 +33,6 @@ typing-inspect, }: -let - stopwords = fetchzip { - url = "https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/stopwords.zip"; - hash = "sha256-tX1CMxSvFjr0nnLxbbycaX/IBnzHFxljMZceX5zElPY="; - }; - - punkt = fetchzip { - url = "https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/tokenizers/punkt.zip"; - hash = "sha256-SKZu26K17qMUg7iCFZey0GTECUZ+sTTrF/pqeEgJCos="; - }; -in - buildPythonPackage rec { pname = "llama-index-core"; version = "0.10.60"; @@ -67,12 +55,12 @@ buildPythonPackage rec { # Setting `NLTK_DATA` to a writable path can also solve this problem, but it needs to be done in # every package that depends on `llama-index-core` for `pythonImportsCheck` not to fail, so this # solution seems more elegant. - patchPhase = '' + postPatch = '' mkdir -p llama_index/core/_static/nltk_cache/corpora/stopwords/ - cp -r ${stopwords}/* llama_index/core/_static/nltk_cache/corpora/stopwords/ + cp -r ${nltk-data.stopwords}/corpora/stopwords/* llama_index/core/_static/nltk_cache/corpora/stopwords/ mkdir -p llama_index/core/_static/nltk_cache/tokenizers/punkt/ - cp -r ${punkt}/* llama_index/core/_static/nltk_cache/tokenizers/punkt/ + cp -r ${nltk-data.punkt}/tokenizers/punkt/* llama_index/core/_static/nltk_cache/tokenizers/punkt/ ''; build-system = [ poetry-core ];