File python-granian.spec of Package python-granian

#
# spec file for package python-granian
#
# Copyright (c) 2025 SUSE LLC
#
# 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-granian
Version:        2.5.2
Release:        0
Summary:        A Rust HTTP server for Python applications
License:        BSD-3-Clause
URL:            https://github.com/emmett-framework/granian
Source0:        https://files.pythonhosted.org/packages/source/g/granian/granian-%{version}.tar.gz
Source1:        vendor.tar.xz
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module base >= 3.9}
BuildRequires:  %{python_module maturin >= 1.8.0}
BuildRequires:  %{python_module pip}
BuildRequires:  cargo-packaging
BuildRequires:  dos2unix
# SECTION test requirements
BuildRequires:  %{python_module click >= 8.0.0}
BuildRequires:  %{python_module pytest >= 8.3.0}
BuildRequires:  %{python_module httpx >= 0.28}
BuildRequires:  %{python_module pytest-asyncio >= 0.26}
BuildRequires:  %{python_module sniffio >= 1.3}
# >= 15.0
BuildRequires:  %{python_module websockets}
# /SECTION
BuildRequires:  fdupes
Requires:       python-click >= 8.0.0
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       %{name} = %{version}-%{release}
Obsoletes:      %{name} < %{version}-%{release}
%python_subpackages

%description
Granian is a Rust HTTP server for Python applications built on top of
Hyper and Tokio.

%package dotenv
Summary:        Allows to load environment files
Requires:       %{name} = %{version}-%{release}
Requires:       python-dotenv >= 1.1

%description dotenv
Python extra dependency `dotenv` for python-granian. Allows to load
environment files

%package pname
Summary:        Allows to customize processes' names
Requires:       %{name} = %{version}-%{release}
Requires:       python-setproctitle >= 1.3.3

%description pname
Python extra dependency `pname` for python-granian. Allows to customize
processes' names

%package reload
Summary:        Adds reload on changes functionality to granian
Requires:       %{name} = %{version}-%{release}
Requires:       python-watchfiles >= 1.0

%description reload
Python extra dependency `reload` for python-granian. Adds reload on
changes functionality

%package uvloop
Summary:        Adds uvloop dependency for granian
Requires:       %{name} = %{version}-%{release}
Requires:       python-uvloop >= 0.18.0

%description uvloop
Python extra dependency `uvloop` for python-granian. Adds uvloop as drop-in
replacement of the built-in asyncio event loop.

%prep
%autosetup -p1 -n granian-%{version} -a1

%build
%pyproject_wheel

%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/granian
%python_expand %fdupes %{buildroot}%{$python_sitearch}

%post
%python_install_alternative granian

%postun
%python_uninstall_alternative granian

%files %{python_files}
%doc README.md
%license LICENSE
%python_alternative %{_bindir}/granian
%{python_sitearch}/granian
%{python_sitearch}/granian-%{version}.dist-info

%files %{python_files dotenv}
%files %{python_files pname}
%files %{python_files reload}
%files %{python_files uvloop}

%changelog
openSUSE Build Service is sponsored by