about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSamuel Ainsworth <sam@jurabio.com>2023-08-09 16:40:01 -0400
committerSamuel Ainsworth <sam@jurabio.com>2023-08-09 16:40:01 -0400
commitbbccb5e32f0458bb7c3b5ae3919e827867669622 (patch)
tree0b83b5c8a82bfa6632c1b063bd856dad673bf6b0 /pkgs
parentfa1d4611cc2ce41d7b93c4a8e8db0efaaf286475 (diff)
python3Packages.minichain: init at 0.3.3
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/minichain/default.nix65
-rw-r--r--pkgs/top-level/python-packages.nix2
2 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/minichain/default.nix b/pkgs/development/python-modules/minichain/default.nix
new file mode 100644
index 0000000000000..39113a58ec41b
--- /dev/null
+++ b/pkgs/development/python-modules/minichain/default.nix
@@ -0,0 +1,65 @@
+{ buildPythonPackage
+, eliot
+, fetchPypi
+, google-search-results
+, jinja2
+, lib
+, manifest-ml
+, openai
+, pytestCheckHook
+, pythonRelaxDepsHook
+}:
+
+buildPythonPackage rec {
+  pname = "minichain";
+  version = "0.3.3";
+
+  # See https://github.com/srush/MiniChain/issues/23 and https://github.com/NixOS/nixpkgs/issues/248185 as to why we
+  # don't fetchFromGitHub.
+  src = fetchPypi {
+    inherit pname version;
+    hash = "sha256-+mju1Mz/aojROpiOVzv6WoRNTrhgCub4yyYLEWcHWh0=";
+  };
+
+  # See https://github.com/srush/MiniChain/issues/24.
+  postPatch = ''
+    substituteInPlace ./minichain/__init__.py --replace "from .gradio import GradioConf, show" ""
+  '';
+
+  nativeBuildInputs = [ pythonRelaxDepsHook ];
+
+  pythonRemoveDeps = [
+    # Only used in the examples:
+    "datasets"
+    "faiss-cpu"
+    "jinja2-highlight"
+    "trio"
+
+    # Not used anywhere:
+    "eliot-tree"
+
+    # Not yet packaged in nixpkgs:
+    "gradio"
+  ];
+
+  # Some of these could be made optional. Certain packages are used by certain backends.
+  propagatedBuildInputs = [
+    eliot
+    google-search-results
+    jinja2
+    manifest-ml
+    openai
+  ];
+
+  pythonImportsCheck = [ "minichain" ];
+
+  nativeCheckInputs = [ pytestCheckHook ];
+
+  meta = with lib; {
+    description = "A tiny library for coding with large language models";
+    homepage = "https://srush-minichain.hf.space";
+    changelog = "https://github.com/srush/MiniChain/releases/tag/v${version}";
+    license = licenses.mit;
+    maintainers = with maintainers; [ samuela ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index b4757bf750eb3..ce68d4fc61a59 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -6514,6 +6514,8 @@ self: super: with self; {
     inherit (pkgs.darwin.apple_sdk.frameworks) AudioToolbox CoreAudio;
   };
 
+  minichain = callPackage ../development/python-modules/minichain { };
+
   minidb = callPackage ../development/python-modules/minidb { };
 
   minidump = callPackage ../development/python-modules/minidump { };