1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 httpx,
6 pillow,
7 poetry-core,
8 pytest-asyncio,
9 pytest-httpserver,
10 pytestCheckHook,
11 pythonOlder,
12 pythonRelaxDepsHook,
13}:
14
15buildPythonPackage rec {
16 pname = "ollama";
17 version = "0.2.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "ollama";
24 repo = "ollama-python";
25 rev = "refs/tags/v${version}";
26 hash = "sha256-kfotKUUXBekUd0X32BYAjNWvQJO94bdEDCSrBg2yJRQ=";
27 };
28
29 postPatch = ''
30 substituteInPlace pyproject.toml \
31 --replace-fail "0.0.0" "${version}"
32 '';
33
34 pythonRelaxDeps = [ "httpx" ];
35
36 build-system = [ poetry-core ];
37
38 nativeBuildInputs = [ pythonRelaxDepsHook ];
39
40 dependencies = [ httpx ];
41
42 nativeCheckInputs = [
43 pillow
44 pytest-asyncio
45 pytest-httpserver
46 pytestCheckHook
47 ];
48
49 pythonImportsCheck = [ "ollama" ];
50
51 meta = with lib; {
52 description = "Ollama Python library";
53 homepage = "https://github.com/ollama/ollama-python";
54 changelog = "https://github.com/ollama/ollama-python/releases/tag/v${version}";
55 license = licenses.mit;
56 maintainers = with maintainers; [ fab ];
57 };
58}