Files
nixpkgs/pkgs/development/python-modules/openai/default.nix
T
happysalada 5f69f0ed2e python311Packages.openai: 0.28.1 -> 1.3.7
openai: cleanup
2023-12-04 03:02:51 +00:00

91 lines
1.5 KiB
Nix

{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, hatchling
# propagated
, httpx
, pydantic
, typing-extensions
, anyio
, distro
, sniffio
, tqdm
# optional
, numpy
, pandas
, pandas-stubs
# tests
, pytestCheckHook
, pytest-asyncio
, pytest-mock
, respx
, dirty-equals
}:
buildPythonPackage rec {
pname = "openai";
version = "1.3.7";
pyproject = true;
disabled = pythonOlder "3.7.1";
src = fetchFromGitHub {
owner = "openai";
repo = "openai-python";
rev = "refs/tags/v${version}";
hash = "sha256-Pa53s3U5vby1Fq14WMCJnSR6KA3xkVHmBexkNoX/0sk=";
};
nativeBuildInputs = [
hatchling
];
propagatedBuildInputs = [
httpx
pydantic
anyio
distro
sniffio
tqdm
] ++ lib.optionals (pythonOlder "3.8") [
typing-extensions
];
passthru.optional-dependencies = {
datalib = [
numpy
pandas
pandas-stubs
];
};
pythonImportsCheck = [
"openai"
];
nativeCheckInputs = [
pytestCheckHook
pytest-asyncio
pytest-mock
respx
dirty-equals
];
OPENAI_API_KEY = "sk-foo";
disabledTestPaths = [
# makes network requests
"tests/test_client.py"
"tests/api_resources"
];
meta = with lib; {
description = "Python client library for the OpenAI API";
homepage = "https://github.com/openai/openai-python";
changelog = "https://github.com/openai/openai-python/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ malo ];
};
}