From 666a6cfd88b3e5106a9180e06ea128db8084be0e Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 7 Apr 2025 20:25:01 +0200 Subject: [PATCH] gnu: python-openai: Update to 1.3.5. * gnu/packages/python-web.scm (python-openai): Update to 1.3.5. [arguments]: Adjust list of disabled tests; add phase 'relax-requirements and 'httpx-compatibility. [propagated-inputs]: Add python-distro, python-httpx, and python-pydantic-2. [native-inputs]: Remove python-black; add python-dirty-equals, python-hatchling, and nss-certs-for-test. Change-Id: I47210abe6a7bc0f5141c41b2a60a45f3b83457ce --- gnu/packages/python-web.scm | 50 +++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm index 2443ab1195..b8230b4117 100644 --- a/gnu/packages/python-web.scm +++ b/gnu/packages/python-web.scm @@ -3016,13 +3016,16 @@ service.") (define-public python-openai (package (name "python-openai") - (version "0.28.1") + (version "1.3.5") (source (origin - (method url-fetch) - (uri (pypi-uri "openai" version)) + (method git-fetch) + (uri (git-reference + (url "https://github.com/openai/openai-python") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) (sha256 (base32 - "1j6wsavgrxzh6ls8hp45nllz8f5l65a6vzk0lvhlqnx6579xmqab")))) + "0k1rwhj7v22x5bnv9xbk9nj9grxqmmclh9538qqjadgqxfn5x74q")))) (build-system pyproject-build-system) (arguments (list @@ -3030,12 +3033,43 @@ service.") ;; These require internet access and an openai API key. '(list "--ignore=openai/tests/asyncio/test_endpoints.py" "--ignore=openai/tests/test_endpoints.py" + "--ignore-glob=tests/api_resources/*" + ;; Needs respx + "--ignore=tests/api_resources/audio/test_speech.py" + "--ignore=tests/api_resources/test_files.py" + "--ignore=tests/test_client.py" "-k" "not test_requestor_cycle_sessions\ and not test_requestor_sets_request_id\ - and not test_file_cli"))) - (propagated-inputs (list python-aiohttp python-requests python-tqdm - python-typing-extensions)) - (native-inputs (list python-black python-pytest python-pytest-asyncio + and not test_file_cli\ + and not test_basic_async\ + and not test_async\ + and not test_datetime_with_alias\ + and not test_pydantic") + #:phases + '(modify-phases %standard-phases + (add-after 'unpack 'relax-requirements + (lambda _ + (substitute* "pyproject.toml" + (("distro>=1.7.0") "distro>=1.6.0") + (("anyio>=3.5.0, <4") "anyio")))) + (add-after 'unpack 'httpx-compatibility + (lambda _ + (substitute* "src/openai/_base_client.py" + (("proxies=proxies,") "") + (("self._proxies = proxies") "") + (("proxies: ProxiesTypes . None,") ""))))))) + (propagated-inputs + (list python-aiohttp + python-distro + python-httpx + python-pydantic-2 + python-requests + python-tqdm + python-typing-extensions)) + (native-inputs (list nss-certs-for-test + python-dirty-equals + python-hatchling + python-pytest python-pytest-asyncio python-pytest-mock python-setuptools python-wheel)) (home-page "https://github.com/openai/openai-python") (synopsis "Python client library for the OpenAI API")