%global _empty_manifest_terminate_build 0 Name: python-asyncpg-listen Version: 0.0.6 Release: 1 Summary: Helps to use PostgreSQL listen/notify with asyncpg License: MIT URL: https://github.com/Pliner/asyncpg-listen Source0: https://mirrors.aliyun.com/pypi/web/packages/3b/1f/a6f040117f88b32cffa25b3fa5984822e0b6a8c2baa854bbe5913499370d/asyncpg-listen-0.0.6.tar.gz BuildArch: noarch Requires: python3-asyncpg Requires: python3-async-timeout %description # asyncpg-listen This library simplifies usage of listen/notify with [asyncpg](https://github.com/MagicStack/asyncpg): 1. Handles loss of a connection 2. Simplifies notifications processing from multiple channels 3. Setups a timeout for receiving a notification 4. Allows to receive all notifications/only last notification depending on ListenPolicy. ```python import asyncio import asyncpg import asyncpg_listen async def handle_notifications(notification: asyncpg_listen.NotificationOrTimeout) -> None: print(f"{notification} has been received") async def main(): listener = asyncpg_listen.NotificationListener(asyncpg_listen.connect_func(user="postgres")) listener_task = asyncio.create_task( listener.run( {"simple": handle_notifications}, policy=asyncpg_listen.ListenPolicy.LAST, notification_timeout=5 ) ) await asyncio.sleep(1) connection = await asyncpg.connect(user="postgres") try: for i in range(42): await connection.execute(f"NOTIFY simple, '{i}'") finally: await connection.close() await asyncio.sleep(1) listener_task.cancel() asyncio.run(main()) ``` ## v0.0.6 (2022-11-02) * [Add support of python 3.11](https://github.com/anna-money/asyncpg-listen/pull/135) ## v0.0.5 (2022-05-23) * [Wait for tasks cancellation](https://github.com/anna-money/asyncpg-listen/pull/96) ## v0.0.4 (2022-01-24) * [Reset failed attempts counter on successful connection](https://github.com/anna-money/asyncpg-listen/pull/58) ## v0.0.3 (2022-01-23) * [Support python 3.8](https://github.com/anna-money/asyncpg-listen/pull/55) ## v0.0.2 (2021-11-02) * [Support async-timeout 4.0+](https://github.com/Pliner/asyncpg-listen/pull/10) ## v0.0.1 (2021-10-27) * A first version %package -n python3-asyncpg-listen Summary: Helps to use PostgreSQL listen/notify with asyncpg Provides: python-asyncpg-listen BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-asyncpg-listen # asyncpg-listen This library simplifies usage of listen/notify with [asyncpg](https://github.com/MagicStack/asyncpg): 1. Handles loss of a connection 2. Simplifies notifications processing from multiple channels 3. Setups a timeout for receiving a notification 4. Allows to receive all notifications/only last notification depending on ListenPolicy. ```python import asyncio import asyncpg import asyncpg_listen async def handle_notifications(notification: asyncpg_listen.NotificationOrTimeout) -> None: print(f"{notification} has been received") async def main(): listener = asyncpg_listen.NotificationListener(asyncpg_listen.connect_func(user="postgres")) listener_task = asyncio.create_task( listener.run( {"simple": handle_notifications}, policy=asyncpg_listen.ListenPolicy.LAST, notification_timeout=5 ) ) await asyncio.sleep(1) connection = await asyncpg.connect(user="postgres") try: for i in range(42): await connection.execute(f"NOTIFY simple, '{i}'") finally: await connection.close() await asyncio.sleep(1) listener_task.cancel() asyncio.run(main()) ``` ## v0.0.6 (2022-11-02) * [Add support of python 3.11](https://github.com/anna-money/asyncpg-listen/pull/135) ## v0.0.5 (2022-05-23) * [Wait for tasks cancellation](https://github.com/anna-money/asyncpg-listen/pull/96) ## v0.0.4 (2022-01-24) * [Reset failed attempts counter on successful connection](https://github.com/anna-money/asyncpg-listen/pull/58) ## v0.0.3 (2022-01-23) * [Support python 3.8](https://github.com/anna-money/asyncpg-listen/pull/55) ## v0.0.2 (2021-11-02) * [Support async-timeout 4.0+](https://github.com/Pliner/asyncpg-listen/pull/10) ## v0.0.1 (2021-10-27) * A first version %package help Summary: Development documents and examples for asyncpg-listen Provides: python3-asyncpg-listen-doc %description help # asyncpg-listen This library simplifies usage of listen/notify with [asyncpg](https://github.com/MagicStack/asyncpg): 1. Handles loss of a connection 2. Simplifies notifications processing from multiple channels 3. Setups a timeout for receiving a notification 4. Allows to receive all notifications/only last notification depending on ListenPolicy. ```python import asyncio import asyncpg import asyncpg_listen async def handle_notifications(notification: asyncpg_listen.NotificationOrTimeout) -> None: print(f"{notification} has been received") async def main(): listener = asyncpg_listen.NotificationListener(asyncpg_listen.connect_func(user="postgres")) listener_task = asyncio.create_task( listener.run( {"simple": handle_notifications}, policy=asyncpg_listen.ListenPolicy.LAST, notification_timeout=5 ) ) await asyncio.sleep(1) connection = await asyncpg.connect(user="postgres") try: for i in range(42): await connection.execute(f"NOTIFY simple, '{i}'") finally: await connection.close() await asyncio.sleep(1) listener_task.cancel() asyncio.run(main()) ``` ## v0.0.6 (2022-11-02) * [Add support of python 3.11](https://github.com/anna-money/asyncpg-listen/pull/135) ## v0.0.5 (2022-05-23) * [Wait for tasks cancellation](https://github.com/anna-money/asyncpg-listen/pull/96) ## v0.0.4 (2022-01-24) * [Reset failed attempts counter on successful connection](https://github.com/anna-money/asyncpg-listen/pull/58) ## v0.0.3 (2022-01-23) * [Support python 3.8](https://github.com/anna-money/asyncpg-listen/pull/55) ## v0.0.2 (2021-11-02) * [Support async-timeout 4.0+](https://github.com/Pliner/asyncpg-listen/pull/10) ## v0.0.1 (2021-10-27) * A first version %prep %autosetup -n asyncpg-listen-0.0.6 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-asyncpg-listen -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Jun 20 2023 Python_Bot - 0.0.6-1 - Package Spec generated