about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/openai
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
committerAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
commit99fcaeccb89621dd492203ce1f2d551c06f228ed (patch)
tree41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/development/python-modules/openai
parent59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff)
parent75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff)
downloadnixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/config/console.nix
	nixpkgs/nixos/modules/services/mail/mailman.nix
	nixpkgs/nixos/modules/services/mail/public-inbox.nix
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/nixos/modules/services/networking/ssh/sshd.nix
	nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix
	nixpkgs/pkgs/applications/networking/irc/weechat/default.nix
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/interpreters/python/default.nix
	nixpkgs/pkgs/development/node-packages/overrides.nix
	nixpkgs/pkgs/development/tools/b4/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix
	nixpkgs/pkgs/servers/mail/public-inbox/default.nix
	nixpkgs/pkgs/tools/security/pinentry/default.nix
	nixpkgs/pkgs/tools/text/unoconv/default.nix
	nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/openai')
-rw-r--r--nixpkgs/pkgs/development/python-modules/openai/default.nix81
1 files changed, 58 insertions, 23 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/openai/default.nix b/nixpkgs/pkgs/development/python-modules/openai/default.nix
index a95d63b830b3..4ccdbd94c128 100644
--- a/nixpkgs/pkgs/development/python-modules/openai/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/openai/default.nix
@@ -1,63 +1,98 @@
 { lib
 , buildPythonPackage
 , fetchFromGitHub
-, pythonOlder
-
-# Python dependencies
+, aiohttp
+, matplotlib
 , numpy
 , openpyxl
 , pandas
 , pandas-stubs
+, plotly
+, pytest-asyncio
+, pytest-mock
+, pytestCheckHook
+, pythonOlder
 , requests
 , scikit-learn
 , tenacity
 , tqdm
+, typing-extensions
 , wandb
-
-# Check dependencies
-, pytest-mock
-, pytestCheckHook
+, withOptionalDependencies ? false
 }:
 
 buildPythonPackage rec {
   pname = "openai";
-  version = "0.22.1";
+  version = "0.27.7";
+  format = "setuptools";
 
   disabled = pythonOlder "3.7.1";
 
-  # Use GitHub source since PyPi source does not include tests
   src = fetchFromGitHub {
     owner = "openai";
     repo = "openai-python";
-    rev = "v${version}";
-    sha256 = "sha256-QUnsm0ui1BFlLqAlH1bp7uDbhiRigePrAPAkSRjftM4=";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-C952ZBp458kPge9ZTUBY6EoPh6Vrq9D2y1WQpCG1rEQ=";
   };
 
   propagatedBuildInputs = [
-    numpy
-    openpyxl
-    pandas
-    pandas-stubs
+    aiohttp
     requests
-    scikit-learn
-    tenacity
     tqdm
-    wandb
+  ] ++ lib.optionals (pythonOlder "3.8") [
+    typing-extensions
+  ] ++ lib.optionals withOptionalDependencies (builtins.attrValues {
+    inherit (passthru.optional-dependencies) embeddings wandb;
+  });
+
+  passthru.optional-dependencies = {
+    datalib = [
+      numpy
+      openpyxl
+      pandas
+      pandas-stubs
+    ];
+    embeddings = [
+      matplotlib
+      plotly
+      scikit-learn
+      tenacity
+    ] ++ passthru.optional-dependencies.datalib;
+    wandb = [
+      wandb
+    ] ++ passthru.optional-dependencies.datalib;
+  };
+
+  pythonImportsCheck = [
+    "openai"
+  ];
+
+  nativeCheckInputs = [
+    pytestCheckHook
+    pytest-asyncio
+    pytest-mock
+  ];
+
+  pytestFlagsArray = [
+    "openai/tests"
   ];
 
-  pythonImportsCheck = [ "openai" ];
-  checkInputs = [ pytestCheckHook pytest-mock ];
-  pytestFlagsArray = [ "openai/tests" ];
   OPENAI_API_KEY = "sk-foo";
+
   disabledTestPaths = [
-    "openai/tests/test_endpoints.py" # requires a real API key
+    # 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"
   ];
 
   meta = with lib; {
     description = "Python client library for the OpenAI API";
     homepage = "https://github.com/openai/openai-python";
+    changelog = "https://github.com/openai/openai-python/releases/tag/v${version}";
     license = licenses.mit;
-    maintainers = [ maintainers.malo ];
+    maintainers = with maintainers; [ malo ];
   };
 }