diff --git a/pkgs/development/python-modules/dashscope/default.nix b/pkgs/development/python-modules/dashscope/default.nix new file mode 100644 index 000000000000..e5b7c8cf5661 --- /dev/null +++ b/pkgs/development/python-modules/dashscope/default.nix @@ -0,0 +1,73 @@ +{ + # Basic + lib, + buildPythonPackage, + fetchFromGitHub, + # Build system + setuptools, + # Dependencies + aiohttp, + requests, + websocket-client, + cryptography, + certifi, + # Test + pytestCheckHook, + tiktoken, +}: + +buildPythonPackage rec { + pname = "dashscope"; + version = "1.24.4"; + pyproject = true; + + src = fetchFromGitHub { + owner = "dashscope"; + repo = "dashscope-sdk-python"; + tag = "v${version}"; + hash = "sha256-PX7RoL4EGMU62G64+T6tjgDgO+SAOZNysl199kvAWME="; + }; + + build-system = [ setuptools ]; + + dependencies = [ + aiohttp + requests + websocket-client + cryptography + certifi + ]; + + # Specify the version explicitly + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "version=get_version()," "version='${version}'," + ''; + + nativeCheckInputs = [ + pytestCheckHook + tiktoken + ]; + + pythonImportsCheck = [ "dashscope" ]; + + disabledTests = [ + # Needs network access and/or API key + "TestAsyncImageSynthesisRequest" + "TestAsyncRequest" + "TestAsyncVideoSynthesisRequest" + "TestEncryption" + "TestSpeechRecognition" + "TestSpeechTranscribe" + "TestSynthesis" + "TestWebSocketAsyncRequest" + "TestWebSocketSyncRequest" + ]; + + meta = { + description = "Python SDK for dashscope"; + homepage = "https://github.com/dashscope/dashscope-sdk-python"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ thattemperature ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 87a2df40a935..2259ce229335 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3327,6 +3327,8 @@ self: super: with self; { dashing = callPackage ../development/python-modules/dashing { }; + dashscope = callPackage ../development/python-modules/dashscope { }; + dask = callPackage ../development/python-modules/dask { }; dask-awkward = callPackage ../development/python-modules/dask-awkward { };