From 48ed6c442a53c69bfdc26c11bf5770a73413c806 Mon Sep 17 00:00:00 2001 From: Samuel Ainsworth Date: Tue, 22 Aug 2023 20:44:01 -0400 Subject: [PATCH] python3Packages.minichain: init at 0.3.3 (#248195) * python3Packages.minichain: init at 0.3.3 * Update pkgs/development/python-modules/minichain/default.nix Co-authored-by: OTABI Tomoya * python3Packages.minichain: add `doCheck = false;` * python3Packages.minichain: add `disabled` --------- Co-authored-by: Samuel Ainsworth Co-authored-by: OTABI Tomoya --- .../python-modules/minichain/default.nix | 73 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 75 insertions(+) create mode 100644 pkgs/development/python-modules/minichain/default.nix diff --git a/pkgs/development/python-modules/minichain/default.nix b/pkgs/development/python-modules/minichain/default.nix new file mode 100644 index 000000000000..1e69fbb1f25b --- /dev/null +++ b/pkgs/development/python-modules/minichain/default.nix @@ -0,0 +1,73 @@ +{ buildPythonPackage +, eliot +, fetchPypi +, google-search-results +, jinja2 +, lib +, manifest-ml +, openai +, pytestCheckHook +, pythonAtLeast +, pythonRelaxDepsHook +}: + +buildPythonPackage rec { + pname = "minichain"; + version = "0.3.3"; + format = "setuptools"; + + # See https://github.com/NixOS/nixpkgs/pull/248195#issuecomment-1687398702. + disabled = pythonAtLeast "3.11"; + + # 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 + ]; + + # As of 0.3.3, the PyPI distribution does not include any tests. + doCheck = false; + + 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 2dc8e5159f28..aa997d979874 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6550,6 +6550,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 { };