about summary refs log tree commit diff
path: root/pkgs/development/python-modules/llm/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/llm/default.nix')
-rw-r--r--pkgs/development/python-modules/llm/default.nix98
1 files changed, 44 insertions, 54 deletions
diff --git a/pkgs/development/python-modules/llm/default.nix b/pkgs/development/python-modules/llm/default.nix
index 5626da5e3858e..bd5a3e34a4a4e 100644
--- a/pkgs/development/python-modules/llm/default.nix
+++ b/pkgs/development/python-modules/llm/default.nix
@@ -1,38 +1,47 @@
-{ lib
-, buildPythonApplication
-, buildPythonPackage
-, fetchFromGitHub
-, makeWrapper
-, pytestCheckHook
-, python3
-, pythonOlder
-, ruff
-, setuptools
+{
+  lib,
+  buildPythonApplication,
+  buildPythonPackage,
+  fetchFromGitHub,
+  makeWrapper,
+  pytestCheckHook,
+  python,
+  pythonOlder,
+  ruff,
+  setuptools,
+  click-default-group,
+  numpy,
+  openai,
+  pip,
+  pluggy,
+  pydantic,
+  python-ulid,
+  pyyaml,
+  sqlite-migrate,
+  cogapp,
+  pytest-httpx,
+  sqlite-utils,
 }:
 let
   llm = buildPythonPackage rec {
     pname = "llm";
-    version = "0.13.1";
+    version = "0.16";
     pyproject = true;
 
+    build-system = [ setuptools ];
+
     disabled = pythonOlder "3.8";
 
     src = fetchFromGitHub {
       owner = "simonw";
       repo = "llm";
       rev = "refs/tags/${version}";
-      hash = "sha256-Nq6pduzl8IK+nA3pctst/W4ux7+P6mBFTEHMF+vtBQw=";
+      hash = "sha256-ew8080Lv1ObjUaGicaGrj8IXXA7rtdgcWhp41O8gfVE=";
     };
 
-    patches = [
-      ./001-disable-install-uninstall-commands.patch
-    ];
-
-    nativeBuildInputs = [
-      setuptools
-    ];
+    patches = [ ./001-disable-install-uninstall-commands.patch ];
 
-    propagatedBuildInputs = with python3.pkgs; [
+    dependencies = [
       click-default-group
       numpy
       openai
@@ -46,7 +55,7 @@ let
       sqlite-utils
     ];
 
-    nativeCheckInputs = with python3.pkgs; [
+    nativeCheckInputs = [
       cogapp
       numpy
       pytest-httpx
@@ -60,11 +69,11 @@ let
       "tests/"
     ];
 
-    pythonImportsCheck = [
-      "llm"
-    ];
+    pythonImportsCheck = [ "llm" ];
 
-    passthru = {inherit withPlugins;};
+    passthru = {
+      inherit withPlugins;
+    };
 
     meta = with lib; {
       homepage = "https://github.com/simonw/llm";
@@ -72,37 +81,18 @@ let
       changelog = "https://github.com/simonw/llm/releases/tag/${version}";
       license = licenses.asl20;
       mainProgram = "llm";
-      maintainers = with maintainers; [aldoborrero];
+      maintainers = with maintainers; [
+        aldoborrero
+        mccartykim
+      ];
     };
   };
 
-  withPlugins = plugins: buildPythonApplication {
-    inherit (llm) pname version;
-    format = "other";
-
-    disabled = pythonOlder "3.8";
-
-    dontUnpack = true;
-    dontBuild = true;
-    doCheck = false;
-
-    nativeBuildInputs = [
-      makeWrapper
-    ];
-
-    installPhase = ''
-      makeWrapper ${llm}/bin/llm $out/bin/llm \
-        --prefix PYTHONPATH : "${llm}/${python3.sitePackages}:$PYTHONPATH"
-      ln -sfv ${llm}/lib $out/lib
-    '';
+  withPlugins = throw ''
+    llm.withPlugins was confusing to use and has been removed.
+    Please migrate to using python3.withPackages(ps: [ ps.llm ]) instead.
 
-    propagatedBuildInputs = llm.propagatedBuildInputs ++ plugins;
-
-    passthru = llm.passthru // {
-      withPlugins = morePlugins: withPlugins (morePlugins ++ plugins);
-    };
-
-    inherit (llm) meta;
-  };
+    See https://nixos.org/manual/nixpkgs/stable/#python.withpackages-function for more usage examples.
+  '';
 in
-  llm
+llm