emacsPackages.lsp-bridge: 0-unstable-2025-01-11 -> 0-unstable-2025-01-22 (#376531)
[NixPkgs.git] / pkgs / development / python-modules / openai / default.nix
blob53312c5fc25c5cce0941d38eea0ee4ce57e94bf3
2   lib,
3   buildPythonPackage,
4   fetchFromGitHub,
5   pythonAtLeast,
6   pythonOlder,
8   # build-system
9   hatchling,
10   hatch-fancy-pypi-readme,
12   # dependencies
13   anyio,
14   distro,
15   httpx,
16   jiter,
17   pydantic,
18   sniffio,
19   tqdm,
20   typing-extensions,
22   numpy,
23   pandas,
24   pandas-stubs,
25   websockets,
27   # check deps
28   pytestCheckHook,
29   dirty-equals,
30   inline-snapshot,
31   nest-asyncio,
32   pytest-asyncio,
33   pytest-mock,
34   respx,
38 buildPythonPackage rec {
39   pname = "openai";
40   version = "1.59.8";
41   pyproject = true;
43   disabled = pythonOlder "3.8";
45   src = fetchFromGitHub {
46     owner = "openai";
47     repo = "openai-python";
48     tag = "v${version}";
49     hash = "sha256-0NiueCUB5w4H1B5cXSyoO641DGB2J2rF2vGwPQSJJPM=";
50   };
52   build-system = [
53     hatchling
54     hatch-fancy-pypi-readme
55   ];
57   dependencies = [
58     anyio
59     distro
60     httpx
61     jiter
62     pydantic
63     sniffio
64     tqdm
65     typing-extensions
66   ] ++ optional-dependencies.realtime;
68   optional-dependencies = {
69     datalib = [
70       numpy
71       pandas
72       pandas-stubs
73     ];
74     realtime = [
75       websockets
76     ];
77   };
79   pythonImportsCheck = [ "openai" ];
81   nativeCheckInputs = [
82     pytestCheckHook
83     dirty-equals
84     inline-snapshot
85     nest-asyncio
86     pytest-asyncio
87     pytest-mock
88     respx
89   ];
91   pytestFlagsArray = [
92     "-W"
93     "ignore::DeprecationWarning"
94   ];
96   disabledTests =
97     [
98       # Tests make network requests
99       "test_copy_build_request"
100       "test_basic_attribute_access_works"
101     ]
102     ++ lib.optionals (pythonAtLeast "3.13") [
103       # RuntimeWarning: coroutine method 'aclose' of 'AsyncStream._iter_events' was never awaited
104       "test_multi_byte_character_multiple_chunks"
105     ];
107   disabledTestPaths = [
108     # Test makes network requests
109     "tests/api_resources"
110   ];
112   meta = with lib; {
113     description = "Python client library for the OpenAI API";
114     homepage = "https://github.com/openai/openai-python";
115     changelog = "https://github.com/openai/openai-python/blob/v${version}/CHANGELOG.md";
116     license = licenses.mit;
117     maintainers = with maintainers; [ malo ];
118     mainProgram = "openai";
119   };