%global _empty_manifest_terminate_build 0 Name: python-tqp Version: 0.5.1 Release: 1 Summary: An opinionated library for pub/sub over SQS and SNS License: MIT URL: https://github.com/4Catalyzer/tqp Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a9/33/a64749b84350b28763574918cfb781cb9ceb1dd1bb8578f55c503fb2a7a4/tqp-0.5.1.tar.gz BuildArch: noarch Requires: python3-boto3 Requires: python3-pytest Requires: python3-fourmat Requires: python3-pre-commit Requires: python3-moto[server] Requires: python3-boto3 %description # TQP An opinionated library for pub/sub over SQS and SNS ## Topic To publish on a topic: ```py topic = Topic('widgets--created') topic.publish({'id': '123456'}) ``` ## Topic Queue Poller To read from the topic: ```py poller = TopicQueuePoller('my_poller') @poller.handler('widgets--created') def process_created_widget(item): widget_id = item['id'] print(f'Widget {widget_id} was created') poller.start() ``` ### S3 notifications It is also possible to poll for s3 object notifications ```py @poller.s3_handler('my-bucket-name') def process_file_created(msg): print(msg) # { # 'event_name': 'ObjectCreated:Put', # 'bucket_name': 'bespin-dev-consular21d51f71-11lpitfowdylc', # 'object': { # 'key': 'genome.fasta', # 'size': 124, # 'eTag': '5d9d04cd0b9d3b314d9bd622da06ab74', # 'sequencer': '005FAD55883A198E97' # }, # } ``` ### Flask A Flask binding is also provided: ```py poller = FlaskTopicQueuePoller('my_poller', app=flask_app) ``` When using the Flask poller, you can also specify how to format the logs: ```py # the argument (optional) is a function that takes the message payload as input and return a message identifier poller.set_log_formatter(lambda payload: payload["message"].get("id", "")) ``` %package -n python3-tqp Summary: An opinionated library for pub/sub over SQS and SNS Provides: python-tqp BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-tqp # TQP An opinionated library for pub/sub over SQS and SNS ## Topic To publish on a topic: ```py topic = Topic('widgets--created') topic.publish({'id': '123456'}) ``` ## Topic Queue Poller To read from the topic: ```py poller = TopicQueuePoller('my_poller') @poller.handler('widgets--created') def process_created_widget(item): widget_id = item['id'] print(f'Widget {widget_id} was created') poller.start() ``` ### S3 notifications It is also possible to poll for s3 object notifications ```py @poller.s3_handler('my-bucket-name') def process_file_created(msg): print(msg) # { # 'event_name': 'ObjectCreated:Put', # 'bucket_name': 'bespin-dev-consular21d51f71-11lpitfowdylc', # 'object': { # 'key': 'genome.fasta', # 'size': 124, # 'eTag': '5d9d04cd0b9d3b314d9bd622da06ab74', # 'sequencer': '005FAD55883A198E97' # }, # } ``` ### Flask A Flask binding is also provided: ```py poller = FlaskTopicQueuePoller('my_poller', app=flask_app) ``` When using the Flask poller, you can also specify how to format the logs: ```py # the argument (optional) is a function that takes the message payload as input and return a message identifier poller.set_log_formatter(lambda payload: payload["message"].get("id", "")) ``` %package help Summary: Development documents and examples for tqp Provides: python3-tqp-doc %description help # TQP An opinionated library for pub/sub over SQS and SNS ## Topic To publish on a topic: ```py topic = Topic('widgets--created') topic.publish({'id': '123456'}) ``` ## Topic Queue Poller To read from the topic: ```py poller = TopicQueuePoller('my_poller') @poller.handler('widgets--created') def process_created_widget(item): widget_id = item['id'] print(f'Widget {widget_id} was created') poller.start() ``` ### S3 notifications It is also possible to poll for s3 object notifications ```py @poller.s3_handler('my-bucket-name') def process_file_created(msg): print(msg) # { # 'event_name': 'ObjectCreated:Put', # 'bucket_name': 'bespin-dev-consular21d51f71-11lpitfowdylc', # 'object': { # 'key': 'genome.fasta', # 'size': 124, # 'eTag': '5d9d04cd0b9d3b314d9bd622da06ab74', # 'sequencer': '005FAD55883A198E97' # }, # } ``` ### Flask A Flask binding is also provided: ```py poller = FlaskTopicQueuePoller('my_poller', app=flask_app) ``` When using the Flask poller, you can also specify how to format the logs: ```py # the argument (optional) is a function that takes the message payload as input and return a message identifier poller.set_log_formatter(lambda payload: payload["message"].get("id", "")) ``` %prep %autosetup -n tqp-0.5.1 %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-tqp -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu May 18 2023 Python_Bot - 0.5.1-1 - Package Spec generated