Unverified Commit f9aff72b authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python3Packages.llm-cmd: init at 0.2a0 (#359379)

parents 0b5b7169 6a0ff02d
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  # build-system
  setuptools,
  llm,
  # dependencies
  prompt-toolkit,
  pygments,
  # tests
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "llm-cmd";
  version = "0.2a0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "simonw";
    repo = "llm-cmd";
    tag = version;
    hash = "sha256-RhwQEllpee/XP1p0nrgL4m+KjSZzf61J8l1jJGlg94E=";
  };

  # Only needed until https://github.com/simonw/llm-cmd/pull/18 is merged and released
  patches = [ ./fix-test.patch ];
  build-system = [
    setuptools
    # Follows the reasoning from https://github.com/NixOS/nixpkgs/pull/327800#discussion_r1681586659 about including llm in build-system
    llm
  ];

  dependencies = [
    prompt-toolkit
    pygments
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pythonImportCheck = [
    "llm_cmd"
  ];

  meta = {
    description = "Use LLM to generate and execute commands in your shell";
    homepage = "https://github.com/simonw/llm-cmd";
    changelog = "https://github.com/simonw/llm-cmd/releases/tag/${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ erethon ];
  };
}
+13 −0
Original line number Diff line number Diff line
diff --git a/tests/test_cmd.py b/tests/test_cmd.py
index 02b5db8..578ebaa 100644
--- a/tests/test_cmd.py
+++ b/tests/test_cmd.py
@@ -1,6 +1,7 @@
-from llm.plugins import pm
+from llm.plugins import load_plugins, pm


 def test_plugin_is_installed():
+    load_plugins()
     names = [mod.__name__ for mod in pm.get_plugins()]
     assert "llm_cmd" in names
+2 −0
Original line number Diff line number Diff line
@@ -7623,6 +7623,8 @@ self: super: with self; {
  llm = callPackage ../development/python-modules/llm { };
  llm-cmd = callPackage ../development/python-modules/llm-cmd { };
  llm-gguf = callPackage ../development/python-modules/llm-gguf { };
  llm-ollama = callPackage ../development/python-modules/llm-ollama { };