depot/third_party/nixpkgs/pkgs/development/python-modules/openai/default.nix
Default email 0eeabdeb66 Project import generated by Copybara.
GitOrigin-RevId: c07b471b52be8fbc49a7dc194e9b37a6e19ee04d
2022-01-24 21:21:06 -06:00

55 lines
1.1 KiB
Nix

{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
# Python dependencies
, openpyxl
, pandas
, pandas-stubs
, requests
, tqdm
# Check dependencies
, pytest-mock
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "openai";
version = "0.12.0";
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 = "12qkbaw1gyqhs6qwyj65g6l8v5xxnilwgk0gxlwnlzrr82q458ia";
};
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 ];
};
}