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