%global python3_pkgversion 3.11 %global pypi_name nest_asyncio Name: python-nest-asyncio Version: 1.6.0 Release: 2.ac16.py3.11%{?dist} Summary: Patch asyncio to allow nested event loops License: BSD-2-Clause URL: https://github.com/erdewit/nest_asyncio Source0: %{pypi_source} BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: pyproject-rpm-macros %description By design asyncio does not allow its event loop to be nested. This presents a practical problem: When in an environment where the event loop is already running it's impossible to run tasks and wait for the result. Trying to do so will give the error "RuntimeError: This event loop is already running". The issue pops up in various environments, such as web servers, GUI applications and in Jupyter notebooks. This module patches asyncio to allow nested use of asyncio.run and loop.run_until_complete. %package -n python%{python3_pkgversion}-nest-asyncio Summary: %{summary} # This package used to be called python3-nest_asyncio Obsoletes: python3-nest_asyncio < 1.4.3-100 %py_provides python3-nest_asyncio %description -n python%{python3_pkgversion}-nest-asyncio By design asyncio does not allow its event loop to be nested. This presents a practical problem: When in an environment where the event loop is already running it's impossible to run tasks and wait for the result. Trying to do so will give the error "RuntimeError: This event loop is already running". The issue pops up in various environments, such as web servers, GUI applications and in Jupyter notebooks. This module patches asyncio to allow nested use of asyncio.run and loop.run_until_complete. %prep %autosetup -p1 -n %{pypi_name}-%{version} %generate_buildrequires %pyproject_buildrequires -r %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} %check PYTHONPATH=%{buildroot}%{python3_sitelib} %python3 tests/nest_test.py for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done %files -n python%{python3_pkgversion}-nest-asyncio -f %{pyproject_files} %doc README.rst %changelog * Fri May 17 2024 Ding-Yi Chen - 1.6.0-2.ac16.py3.11 - Cut corner packaging