%global srcname openai
%global reponame openai-python
%global _description %{summary}.

Name:           python-%{srcname}
Version:        1.46.0
Release:        %autorelease
Summary:        The official Python library for the OpenAI API

License:        Apache-2.0
URL:            https://github.com/openai/openai-python
Source:         %{url}/archive/refs/tags/v%{version}/%{srcname}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python3-devel

%description
%{_description}

%package -n     python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{srcname}
%{_description}


%prep
%autosetup -p1 -n %{reponame}-%{version}
rm -rf enterprise


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files %{srcname}


%check
%pyproject_check_import
# Tests are not enabled here because most require a running API server
# and/or updated usage of pytrest-asyncio.


%files -n python3-%{srcname} -f %{pyproject_files}
%{_bindir}/openai


%changelog
%autochangelog