# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=hatchling
PYTHON_COMPAT=( python3_{12..14} )

inherit distutils-r1 optfeature pypi

DESCRIPTION="The official Python library for the openai API"
HOMEPAGE="
	https://github.com/openai/openai-python
	https://pypi.org/project/openai/
"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	<dev-python/anyio-5[${PYTHON_USEDEP}]
	>=dev-python/httpx2-2.12.0[${PYTHON_USEDEP}]
	<dev-python/httpx2-3[${PYTHON_USEDEP}]
	>=dev-python/jiter-0.16.0[${PYTHON_USEDEP}]
	<dev-python/jiter-1[${PYTHON_USEDEP}]
	>=dev-python/pydantic-2.4[${PYTHON_USEDEP}]
	<dev-python/pydantic-3[${PYTHON_USEDEP}]
	dev-python/sniffio[${PYTHON_USEDEP}]
	<dev-python/typing-extensions-5[${PYTHON_USEDEP}]
"
# httpx2 already requires anyio >= 4.10.0; retain OpenAI's upper bound.

# Tests need the same Stainless mock-server stack as anthropic.
RESTRICT="test"

pkg_postinst() {
	optfeature "the aiohttp transport (DefaultAioHttpClient)" dev-python/aiohttp
	optfeature "Amazon Bedrock authentication" dev-python/botocore
	optfeature "the Google Vertex AI provider" dev-python/google-auth
	optfeature "the Realtime API over WebSocket" dev-python/websockets
	optfeature "the data helpers" "dev-python/numpy dev-python/pandas"
}