65 lines
1.1 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
poetry-core,
# dependencies
httpx,
pydantic,
# tests
pillow,
pytest-asyncio,
pytest-httpserver,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "ollama";
version = "0.4.8";
pyproject = true;
src = fetchFromGitHub {
owner = "ollama";
repo = "ollama-python";
tag = "v${version}";
hash = "sha256-ZhSbd7Um3+jG3yL3FwCm0lUdi5EQXVjJk0UMLRKeLOQ=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "0.0.0" "${version}"
'';
pythonRelaxDeps = [ "httpx" ];
build-system = [ poetry-core ];
dependencies = [
httpx
pydantic
];
nativeCheckInputs = [
pillow
pytest-asyncio
pytest-httpserver
pytestCheckHook
];
__darwinAllowLocalNetworking = true;
pythonImportsCheck = [ "ollama" ];
meta = {
description = "Ollama Python library";
homepage = "https://github.com/ollama/ollama-python";
changelog = "https://github.com/ollama/ollama-python/releases/tag/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ fab ];
};
}