python3Packages.llm: 0.25 -> 0.26

Diff: https://github.com/simonw/llm/compare/refs/tags/0.25...refs/tags/0.26

Changelog: https://github.com/simonw/llm/releases/tag/0.26

We also need to update llm-echo to a pre-release build to make the tests pass.

Changed files
+38 -19
pkgs
development
+2 -2
pkgs/development/python-modules/llm-echo/default.nix
···
buildPythonPackage rec {
pname = "llm-echo";
-
version = "0.3";
+
version = "0.3a3";
pyproject = true;
src = fetchFromGitHub {
owner = "simonw";
repo = "llm-echo";
tag = version;
-
hash = "sha256-KtdsvXJQRJ3EEJ25i6ccbVxMsWlDsxa+HJ7bFzyYGNI=";
+
hash = "sha256-4345UIyaQx+mYYBAFD5AaX5YbjbnJQt8bKMD5Vl8VJc=";
};
build-system = [
+23 -15
pkgs/development/python-modules/llm/001-disable-install-uninstall-commands.patch
···
-
diff --git i/llm/cli.py w/llm/cli.py
-
index 09e4e2d..8424a5e 100644
-
--- i/llm/cli.py
-
+++ w/llm/cli.py
-
@@ -2383,18 +2383,18 @@ def display_truncated(text):
+
diff --git a/llm/cli.py b/llm/cli.py
+
index 5d53e74..c2b4707 100644
+
--- a/llm/cli.py
+
+++ b/llm/cli.py
+
@@ -2895,30 +2895,38 @@ def display_truncated(text):
+
help="Include pre-release and development versions",
)
-
def install(packages, upgrade, editable, force_reinstall, no_cache_dir):
-
"""Install packages from PyPI into the same environment as LLM"""
+
def install(packages, upgrade, editable, force_reinstall, no_cache_dir, pre):
+
- """Install packages from PyPI into the same environment as LLM"""
- args = ["pip", "install"]
- if upgrade:
- args += ["--upgrade"]
···
- args += ["--force-reinstall"]
- if no_cache_dir:
- args += ["--no-cache-dir"]
+
- if pre:
+
- args += ["--pre"]
- args += list(packages)
- sys.argv = args
- run_module("pip", run_name="__main__")
-
+ click.echo(
+
+ """Install packages from PyPI into the same environment as LLM. Disabled for nixpkgs."""
+
+ raise click.ClickException(
+"""Install command has been disabled for Nix. To install extra `llm` plugins, use the `llm.withPlugins` function.
+
+Example:
···
+```
+"""
+ )
-
-
+
+
@cli.command()
-
@@ -2402,8 +2402,18 @@ def install(packages, upgrade, editable, force_reinstall, no_cache_dir):
+
@click.argument("packages", nargs=-1, required=True)
@click.option("-y", "--yes", is_flag=True, help="Don't ask for confirmation")
def uninstall(packages, yes):
-
"""Uninstall Python packages from the LLM environment"""
+
- """Uninstall Python packages from the LLM environment"""
- sys.argv = ["pip", "uninstall"] + list(packages) + (["-y"] if yes else [])
- run_module("pip", run_name="__main__")
-
+ click.echo(
+
+ """Uninstall Python packages from the LLM environment. Disabled for nixpkgs."""
+
+ raise click.ClickException(
+"""Uninstall command has been disabled for Nix. To remove `llm` plugins, use the `llm.withPlugins` function with the desired set of plugins specified.
+
+Example:
···
+```
+"""
+ )
-
-
+
+
@cli.command()
+
--
+
2.49.0
+
+13 -2
pkgs/development/python-modules/llm/default.nix
···
cogapp,
pytest-asyncio,
pytest-httpx,
+
pytest-recording,
sqlite-utils,
+
syrupy,
+
llm-echo,
}:
let
/**
···
llm = buildPythonPackage rec {
pname = "llm";
-
version = "0.25";
+
version = "0.26";
pyproject = true;
build-system = [ setuptools ];
···
owner = "simonw";
repo = "llm";
tag = version;
-
hash = "sha256-iH1P0VdpwIItY1In7vlM0Sn44Db23TqFp8GZ79/GMJs=";
+
hash = "sha256-KTlNajuZrR0kBX3LatepsNM3PfRVsQn+evEfXTu6juE=";
};
patches = [ ./001-disable-install-uninstall-commands.patch ];
···
numpy
pytest-asyncio
pytest-httpx
+
pytest-recording
+
syrupy
pytestCheckHook
];
doCheck = true;
+
+
# The tests make use of `llm_echo` but that would be a circular dependency.
+
# So we make a local copy in this derivation, as it's a super-simple package of one file.
+
preCheck = ''
+
cp ${llm-echo.src}/llm_echo.py llm_echo.py
+
'';
pytestFlagsArray = [
"-svv"