File python-any-llm.spec of Package python-any-llm
#
# spec file for package python-any-llm
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: python-any-llm
Version: 1.2.0
Release: 0
Summary: A unified interface to communicate with various Large Language Model (LLM) providers.
License: Apache-2.0
URL: https://github.com/mozilla-ai/any-llm
Source: https://github.com/mozilla-ai/any-llm/archive/refs/tags/%{version}.tar.gz#./%{name}-%{version}.tar.gz
BuildRequires: %{python_module base}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: update-alternatives
Requires: update-alternatives
Requires: python-pydantic
Requires: python-openai
Requires: python-rich
Requires: python-httpx
Requires: python-typing-extensions
Requires(post): update-alternatives
Requires(postun): update-alternatives
%python_subpackages
%description
A unified interface to communicate with LLM providers. It allows developers to
switch between different LLM providers without altering their core application
code, leveraging official provider SDKs for compatibility.
The library offers both direct API functions for quick experimentation and an
`AnyLLM` class for production-grade applications requiring connection pooling.
Additionally, it includes an optional `any-llm-gateway`—a FastAPI-based proxy
server—that adds enterprise features like budget management, API key
management, and usage analytics for multi-tenant or cost-sensitive deployments.
%prep
%autosetup -p1 -n any-llm-%{version}
ls -l
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/any-llm-gateway
find %{buildroot} -name '*.py' -exec touch -r %{SOURCE0} {} +
%fdupes %{buildroot}%{_prefix}
%post
%python_install_alternative any-llm-gateway
%postun
%python_uninstall_alternative any-llm-gateway
%files -n python-any-llm
%license LICENSE
%{_bindir}/any-llm-gateway
%ghost /etc/alternatives/any-llm-gateway
%files %{python_files}
%license LICENSE
%{python_sitelib}/any_llm
%{python_sitelib}/any_llm_sdk-0.0.0.dist-info
%{python_alternative %{_bindir}/any-llm-gateway}
%changelog