From 20c25e3794187bbd94da2dbc0455a3a28d1361ca Mon Sep 17 00:00:00 2001 From: Malo Bourgon Date: Mon, 9 Jan 2023 11:30:40 -0800 Subject: [PATCH 1/2] openai: 0.25.0 -> 0.26.1 Diff: https://github.com/openai/openai-python/compare/v0.25.0...v0.26.1 --- .../python-modules/openai/default.nix | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/openai/default.nix b/pkgs/development/python-modules/openai/default.nix index 9a5e34d5dc20..b2582c55a074 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 @@ -20,7 +22,7 @@ buildPythonPackage rec { pname = "openai"; - version = "0.25.0"; + version = "0.26.1"; format = "setuptools"; disabled = pythonOlder "3.7.1"; @@ -29,29 +31,33 @@ 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 ]; 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 +66,7 @@ buildPythonPackage rec { checkInputs = [ pytestCheckHook + pytest-asyncio pytest-mock ]; @@ -72,6 +79,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" From 460bec3492ccd2defd00b6f97a44b553de21701f Mon Sep 17 00:00:00 2001 From: Malo Bourgon Date: Mon, 9 Jan 2023 12:21:52 -0800 Subject: [PATCH 2/2] openai: add `withOptionalDependencies` option --- pkgs/development/python-modules/openai/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/openai/default.nix b/pkgs/development/python-modules/openai/default.nix index b2582c55a074..9d68b4790f8d 100644 --- a/pkgs/development/python-modules/openai/default.nix +++ b/pkgs/development/python-modules/openai/default.nix @@ -18,6 +18,7 @@ , tqdm , typing-extensions , wandb +, withOptionalDependencies ? false }: buildPythonPackage rec { @@ -40,7 +41,9 @@ buildPythonPackage rec { tqdm ] ++ lib.optionals (pythonOlder "3.8") [ typing-extensions - ]; + ] ++ lib.optionals withOptionalDependencies (builtins.attrValues { + inherit (passthru.optional-dependencies) embeddings wandb; + }); passthru.optional-dependencies = { datalib = [