diff --git a/pkgs/development/python-modules/openai/default.nix b/pkgs/development/python-modules/openai/default.nix index cfc719e13666..8aa091a25c71 100644 --- a/pkgs/development/python-modules/openai/default.nix +++ b/pkgs/development/python-modules/openai/default.nix @@ -1,12 +1,14 @@ { lib , buildPythonPackage , fetchFromGitHub +, aiohttp , matplotlib , numpy , openpyxl , pandas , pandas-stubs , plotly +, pytest-asyncio , pytest-mock , pytestCheckHook , pythonOlder @@ -16,11 +18,12 @@ , tqdm , typing-extensions , wandb +, withOptionalDependencies ? false }: buildPythonPackage rec { pname = "openai"; - version = "0.25.0"; + version = "0.26.1"; format = "setuptools"; disabled = pythonOlder "3.7.1"; @@ -29,29 +32,35 @@ buildPythonPackage rec { owner = "openai"; repo = "openai-python"; rev = "v${version}"; - hash = "sha256-bwv7lpdDYlk+y3KBjv7cSvaGr3v02riNCUfPFh6yv1I="; + hash = "sha256-M6ZaYTOBAwLogWPafSnBYw3rUry+sS9VwQWAM9tDfr8="; }; propagatedBuildInputs = [ - numpy - openpyxl - pandas - pandas-stubs + aiohttp requests tqdm + ] ++ lib.optionals (pythonOlder "3.8") [ typing-extensions - ]; + ] ++ lib.optionals withOptionalDependencies (builtins.attrValues { + inherit (passthru.optional-dependencies) embeddings wandb; + }); passthru.optional-dependencies = { - wandb = [ - wandb + datalib = [ + numpy + openpyxl + pandas + pandas-stubs ]; embeddings = [ matplotlib plotly scikit-learn tenacity - ]; + ] ++ passthru.optional-dependencies.datalib; + wandb = [ + wandb + ] ++ passthru.optional-dependencies.datalib; }; pythonImportsCheck = [ @@ -60,6 +69,7 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook + pytest-asyncio pytest-mock ]; @@ -72,6 +82,7 @@ buildPythonPackage rec { disabledTestPaths = [ # Requires a real API key "openai/tests/test_endpoints.py" + "openai/tests/asyncio/test_endpoints.py" # openai: command not found "openai/tests/test_file_cli.py" "openai/tests/test_long_examples_validator.py"