nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5
6# Python dependencies
7, openpyxl
8, pandas
9, pandas-stubs
10, requests
11, tqdm
12, wandb
13
14# Check dependencies
15, pytest-mock
16, pytestCheckHook
17}:
18
19buildPythonPackage rec {
20 pname = "openai";
21 version = "0.18.1";
22
23 disabled = pythonOlder "3.7.1";
24
25 # Use GitHub source since PyPi source does not include tests
26 src = fetchFromGitHub {
27 owner = "openai";
28 repo = "openai-python";
29 rev = "v${version}";
30 sha256 = "sha256-ii/w29aRGhuzR6E+kbknsSrVZlOurpy/tTVGeAYKkXo=";
31 };
32
33 propagatedBuildInputs = [
34 openpyxl
35 pandas
36 pandas-stubs
37 requests
38 tqdm
39 wandb
40 ];
41
42 pythonImportsCheck = [ "openai" ];
43 checkInputs = [ pytestCheckHook pytest-mock ];
44 pytestFlagsArray = [ "openai/tests" ];
45 OPENAI_API_KEY = "sk-foo";
46 disabledTestPaths = [
47 "openai/tests/test_endpoints.py" # requires a real API key
48 "openai/tests/test_file_cli.py"
49 ];
50
51 meta = with lib; {
52 description = "Python client library for the OpenAI API";
53 homepage = "https://github.com/openai/openai-python";
54 license = licenses.mit;
55 maintainers = [ maintainers.malo ];
56 };
57}