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