1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
{
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 = "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 ];
};
}
|