diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/openai/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/openai/default.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/openai/default.nix b/nixpkgs/pkgs/development/python-modules/openai/default.nix new file mode 100644 index 000000000000..542112126b10 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/openai/default.nix @@ -0,0 +1,55 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonOlder + +# Python dependencies +, openpyxl +, pandas +, pandas-stubs +, requests +, tqdm + +# Check dependencies +, pytest-mock +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "openai"; + version = "0.11.5"; + + disabled = pythonOlder "3.7.1"; + + # Use GitHub source since PyPi source does not include tests + src = fetchFromGitHub { + owner = "openai"; + repo = "openai-python"; + rev = "v${version}"; + sha256 = "sha256-6eL3/vDWyIOVjRQo4OO3OgyUG3t8dKPtxzMMTxPCglM="; + }; + + propagatedBuildInputs = [ + openpyxl + pandas + pandas-stubs + requests + tqdm + ]; + + pythonImportsCheck = [ "openai" ]; + checkInputs = [ pytestCheckHook pytest-mock ]; + pytestFlagsArray = [ "openai/tests" ]; + OPENAI_API_KEY = "sk-foo"; + disabledTestPaths = [ + "openai/tests/test_endpoints.py" # requires a real API key + "openai/tests/test_file_cli.py" + ]; + + meta = with lib; { + description = "Python client library for the OpenAI API"; + homepage = "https://github.com/openai/openai-python"; + license = licenses.mit; + maintainers = [ maintainers.malo ]; + }; +} |