about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFabian Affolter <fabian@affolter-engineering.ch>2024-04-28 09:41:58 +0200
committerGitHub <noreply@github.com>2024-04-28 09:41:58 +0200
commit30ddacc06345a478f9528fa29e2c8857b90381b2 (patch)
treed65126d3f268728ea33dd7d9f8ed34d5befe1f7c /pkgs
parent34ddf75c6b8d8128e063f814f94580adb2d3579e (diff)
parent020685b42771c998f9fbe5a968063223a24b7fdb (diff)
Merge pull request #307403 from natsukium/cohere/update
python311Packages.cohere: 4.56 -> 5.3.3
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/cohere/default.nix31
-rw-r--r--pkgs/development/python-modules/httpx-sse/default.nix54
-rw-r--r--pkgs/top-level/python-packages.nix2
3 files changed, 73 insertions, 14 deletions
diff --git a/pkgs/development/python-modules/cohere/default.nix b/pkgs/development/python-modules/cohere/default.nix
index 0383e7d0f9cfc..26deb98e3d451 100644
--- a/pkgs/development/python-modules/cohere/default.nix
+++ b/pkgs/development/python-modules/cohere/default.nix
@@ -1,40 +1,43 @@
 { lib
 , buildPythonPackage
-, fetchpatch
 , fetchPypi
 , poetry-core
 , pythonOlder
-, aiohttp
-, backoff
 , fastavro
-, importlib-metadata
+, httpx
+, httpx-sse
+, pydantic
 , requests
-, urllib3
+, tokenizers
+, types-requests
+, typing-extensions
 }:
 
 buildPythonPackage rec {
   pname = "cohere";
-  version = "4.56";
+  version = "5.3.3";
   pyproject = true;
 
   disabled = pythonOlder "3.7";
 
   src = fetchPypi {
     inherit pname version;
-    hash = "sha256-rOAQzT1A/q74WnfazCMDtou7SnP0h+UGCyBxihqLmzc=";
+    hash = "sha256-+/WcC6sN7U0oCR+gwZOhFtgwPEwLCaQnId2KEjDqJ8M=";
   };
 
-  nativeBuildInputs = [
+  build-system = [
     poetry-core
   ];
 
-  propagatedBuildInputs = [
-    aiohttp
-    backoff
+  dependencies = [
     fastavro
-    importlib-metadata
+    httpx
+    httpx-sse
+    pydantic
     requests
-    urllib3
+    tokenizers
+    types-requests
+    typing-extensions
   ];
 
   # tests require CO_API_KEY
@@ -47,7 +50,7 @@ buildPythonPackage rec {
   meta = with lib; {
     description = "Simplify interfacing with the Cohere API";
     homepage = "https://docs.cohere.com/docs";
-    changelog = "https://github.com/cohere-ai/cohere-python/blob/main/CHANGELOG.md#${builtins.replaceStrings ["."] [""] version}";
+    changelog = "https://github.com/cohere-ai/cohere-python/releases/tag/${version}";
     license = licenses.mit;
     maintainers = with maintainers; [ natsukium ];
   };
diff --git a/pkgs/development/python-modules/httpx-sse/default.nix b/pkgs/development/python-modules/httpx-sse/default.nix
new file mode 100644
index 0000000000000..ff0a4069090bf
--- /dev/null
+++ b/pkgs/development/python-modules/httpx-sse/default.nix
@@ -0,0 +1,54 @@
+{
+  lib,
+  buildPythonPackage,
+  fetchFromGitHub,
+  setuptools,
+  setuptools-scm,
+  wheel,
+  httpx,
+  pytest-asyncio,
+  pytestCheckHook,
+  sse-starlette,
+}:
+
+buildPythonPackage rec {
+  pname = "httpx-sse";
+  version = "0.4.0";
+  pyproject = true;
+
+  src = fetchFromGitHub {
+    owner = "florimondmanca";
+    repo = "httpx-sse";
+    rev = "refs/tags/${version}";
+    hash = "sha256-nU8vkmV/WynzQrSrq9+FQXtfAJPVLpMsRSuntU0HWrE=";
+  };
+
+  # pytest-cov configuration is not necessary for packaging
+  postPatch = ''
+    rm setup.cfg
+  '';
+
+  build-system = [
+    setuptools
+    setuptools-scm
+    wheel
+  ];
+
+  dependencies = [ httpx ];
+
+  pythonImportsCheck = [ "httpx_sse" ];
+
+  nativeCheckInputs = [
+    pytest-asyncio
+    pytestCheckHook
+    sse-starlette
+  ];
+
+  meta = with lib; {
+    description = "Consume Server-Sent Event (SSE) messages with HTTPX";
+    homepage = "https://github.com/florimondmanca/httpx-sse";
+    changelog = "https://github.com/florimondmanca/httpx-sse/blob/${src.rev}/CHANGELOG.md";
+    license = licenses.mit;
+    maintainers = with maintainers; [ natsukium ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index f1d1e3da3068e..c1f378ea1c3b6 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -5515,6 +5515,8 @@ self: super: with self; {
 
   httpx-socks = callPackage ../development/python-modules/httpx-socks { };
 
+  httpx-sse = callPackage ../development/python-modules/httpx-sse { };
+
   huawei-lte-api = callPackage ../development/python-modules/huawei-lte-api { };
 
   huey = callPackage ../development/python-modules/huey { };