2021-12-24 04:21:11 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2024-01-02 11:29:13 +00:00
|
|
|
, pythonOlder
|
|
|
|
, hatchling
|
|
|
|
# propagated
|
|
|
|
, httpx
|
|
|
|
, pydantic
|
|
|
|
, typing-extensions
|
|
|
|
, anyio
|
|
|
|
, distro
|
|
|
|
, sniffio
|
2024-01-25 14:12:00 +00:00
|
|
|
, cached-property
|
2024-01-02 11:29:13 +00:00
|
|
|
, tqdm
|
|
|
|
# optional
|
2022-08-12 12:06:08 +00:00
|
|
|
, numpy
|
2021-12-24 04:21:11 +00:00
|
|
|
, pandas
|
|
|
|
, pandas-stubs
|
2024-01-02 11:29:13 +00:00
|
|
|
# tests
|
|
|
|
, pytestCheckHook
|
2023-02-02 18:25:31 +00:00
|
|
|
, pytest-asyncio
|
2022-10-21 18:38:19 +00:00
|
|
|
, pytest-mock
|
2024-01-02 11:29:13 +00:00
|
|
|
, respx
|
|
|
|
, dirty-equals
|
2021-12-24 04:21:11 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "openai";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "1.9.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = true;
|
2021-12-24 04:21:11 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7.1";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openai";
|
|
|
|
repo = "openai-python";
|
2023-03-04 12:14:45 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-+3tCttKWbWt3Nsf5E6NWYt0yLRV0kfj7Qz6PhaOmBsY=";
|
2021-12-24 04:21:11 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
hatchling
|
|
|
|
];
|
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
propagatedBuildInputs = [
|
2024-01-02 11:29:13 +00:00
|
|
|
httpx
|
|
|
|
pydantic
|
2024-01-25 14:12:00 +00:00
|
|
|
typing-extensions
|
2024-01-02 11:29:13 +00:00
|
|
|
anyio
|
|
|
|
distro
|
|
|
|
sniffio
|
2021-12-24 04:21:11 +00:00
|
|
|
tqdm
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
2024-01-25 14:12:00 +00:00
|
|
|
cached-property
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
passthru.optional-dependencies = {
|
2023-02-02 18:25:31 +00:00
|
|
|
datalib = [
|
|
|
|
numpy
|
|
|
|
pandas
|
|
|
|
pandas-stubs
|
2022-10-21 18:38:19 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"openai"
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-10-21 18:38:19 +00:00
|
|
|
pytestCheckHook
|
2023-02-02 18:25:31 +00:00
|
|
|
pytest-asyncio
|
2022-10-21 18:38:19 +00:00
|
|
|
pytest-mock
|
2024-01-02 11:29:13 +00:00
|
|
|
respx
|
|
|
|
dirty-equals
|
2021-12-24 04:21:11 +00:00
|
|
|
];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
disabledTests = [
|
|
|
|
# makes network requests
|
|
|
|
"test_streaming_response"
|
2024-01-13 08:15:51 +00:00
|
|
|
];
|
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
disabledTestPaths = [
|
2024-01-02 11:29:13 +00:00
|
|
|
# makes network requests
|
|
|
|
"tests/api_resources"
|
2021-12-24 04:21:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python client library for the OpenAI API";
|
|
|
|
homepage = "https://github.com/openai/openai-python";
|
2023-03-04 12:14:45 +00:00
|
|
|
changelog = "https://github.com/openai/openai-python/releases/tag/v${version}";
|
2021-12-24 04:21:11 +00:00
|
|
|
license = licenses.mit;
|
2022-10-21 18:38:19 +00:00
|
|
|
maintainers = with maintainers; [ malo ];
|
2021-12-24 04:21:11 +00:00
|
|
|
};
|
|
|
|
}
|