diff --git a/pkgs/development/python-modules/openai/default.nix b/pkgs/development/python-modules/openai/default.nix index c1cfc7c22bd6..476638d066ef 100644 --- a/pkgs/development/python-modules/openai/default.nix +++ b/pkgs/development/python-modules/openai/default.nix @@ -19,11 +19,17 @@ tqdm, typing-extensions, + # optional-dependencies (datalib) numpy, pandas, pandas-stubs, + + # optional-dependencies (realtime) websockets, + # optional-dependencies (voice-helpers) + sounddevice, + # check deps pytestCheckHook, dirty-equals, @@ -32,11 +38,15 @@ pytest-asyncio, pytest-mock, respx, + + # optional-dependencies toggle + withRealtime ? true, + withVoiceHelpers ? true, }: buildPythonPackage rec { pname = "openai"; - version = "1.66.3"; + version = "1.68.2"; pyproject = true; disabled = pythonOlder "3.8"; @@ -45,24 +55,31 @@ buildPythonPackage rec { owner = "openai"; repo = "openai-python"; tag = "v${version}"; - hash = "sha256-T9ZW/93ovzJgLEjLgzp/4bPezONxqlYNFpe6U8a7q/A="; + hash = "sha256-TA+gr6cFGFlbAUqfgSbLFsoKdSZktPwk6DUfeq99PsM="; }; + postPatch = ''substituteInPlace pyproject.toml --replace-fail "hatchling==1.26.3" "hatchling"''; + build-system = [ hatchling hatch-fancy-pypi-readme ]; - dependencies = [ - anyio - distro - httpx - jiter - pydantic - sniffio - tqdm - typing-extensions - ] ++ optional-dependencies.realtime; + dependencies = + [ + anyio + distro + httpx + jiter + numpy + pydantic + sniffio + sounddevice + tqdm + typing-extensions + ] + ++ lib.optionals withRealtime optional-dependencies.realtime + ++ lib.optionals withVoiceHelpers optional-dependencies.voice-helpers; optional-dependencies = { datalib = [ @@ -73,6 +90,10 @@ buildPythonPackage rec { realtime = [ websockets ]; + voice-helpers = [ + numpy + sounddevice + ]; }; pythonImportsCheck = [ "openai" ];