%global _empty_manifest_terminate_build 0
Name:		python-ansq
Version:	0.2.1
Release:	1
Summary:	Written with native Asyncio NSQ package
License:	MIT
URL:		https://github.com/list-family/ansq
Source0:	https://mirrors.aliyun.com/pypi/web/packages/b9/ff/e53629d479a22361b474b166577d3dc5b0770cd2380a974c57228adc4fe6/ansq-0.2.1.tar.gz
BuildArch:	noarch

Requires:	python3-aiohttp
Requires:	python3-attrs
Requires:	python3-importlib-metadata
Requires:	python3-pytest-cov
Requires:	python3-pytest
Requires:	python3-pytest-asyncio

%description
# ansq - Async NSQ
[![PyPI version](https://badge.fury.io/py/ansq.svg)](https://badge.fury.io/py/ansq)
![Tests](https://github.com/list-family/ansq/workflows/Test/badge.svg)
[![Coverage](https://codecov.io/gh/list-family/ansq/branch/master/graph/badge.svg)](https://codecov.io/gh/list-family/ansq)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ansq)

Written with native Asyncio NSQ package

## Installation

```commandline
python -m pip install ansq
```

## Overview
- `Reader` — high-level class for building consumers with `nsqlookupd` support
- `Writer` — high-level producer class supporting async publishing of messages to `nsqd`
  over the TCP protocol
- `NSQConnection` — low-level class representing a TCP connection to `nsqd`:
    - full TCP wrapper
    - one connection for `sub` and `pub`
    - self-healing: when the connection is lost, reconnects, sends identify
      and auth commands, subscribes to previous topic/channel

## Features

- [x] SUB
- [x] PUB
- [x] Discovery
- [ ] Backoff
- [ ] TLS
- [ ] Deflate
- [ ] Snappy
- [x] Sampling
- [ ] AUTH

## Usage

### Consumer

A simple consumer reads messages from "example_topic" and prints them to stdout.

```python
import asyncio

import ansq


async def main():
    reader = await ansq.create_reader(
        topic="example_topic",
        channel="example_channel",
    )

    async for message in reader.messages():
        print(f"Message: {message.body}")
        await message.fin()

    await reader.close()


if __name__ == "__main__":
    asyncio.run(main())
```

### Producer

A simple producer sends a "Hello, world!" message to "example_topic".

```python
import asyncio

import ansq


async def main():
    writer = await ansq.create_writer()
    await writer.pub(
        topic="example_topic",
        message="Hello, world!",
    )
    await writer.close()


if __name__ == "__main__":
    asyncio.run(main())
```


## Contributing

Create and activate a development virtual environment.

```bash
python -m venv venv
source venv/bin/activate
```

Install `ansq` in editable mode and its testing dependencies.

```bash
python -m pip install -e .[testing]
```

Run tests.

```bash
pytest
```


%package -n python3-ansq
Summary:	Written with native Asyncio NSQ package
Provides:	python-ansq
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-ansq
# ansq - Async NSQ
[![PyPI version](https://badge.fury.io/py/ansq.svg)](https://badge.fury.io/py/ansq)
![Tests](https://github.com/list-family/ansq/workflows/Test/badge.svg)
[![Coverage](https://codecov.io/gh/list-family/ansq/branch/master/graph/badge.svg)](https://codecov.io/gh/list-family/ansq)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ansq)

Written with native Asyncio NSQ package

## Installation

```commandline
python -m pip install ansq
```

## Overview
- `Reader` — high-level class for building consumers with `nsqlookupd` support
- `Writer` — high-level producer class supporting async publishing of messages to `nsqd`
  over the TCP protocol
- `NSQConnection` — low-level class representing a TCP connection to `nsqd`:
    - full TCP wrapper
    - one connection for `sub` and `pub`
    - self-healing: when the connection is lost, reconnects, sends identify
      and auth commands, subscribes to previous topic/channel

## Features

- [x] SUB
- [x] PUB
- [x] Discovery
- [ ] Backoff
- [ ] TLS
- [ ] Deflate
- [ ] Snappy
- [x] Sampling
- [ ] AUTH

## Usage

### Consumer

A simple consumer reads messages from "example_topic" and prints them to stdout.

```python
import asyncio

import ansq


async def main():
    reader = await ansq.create_reader(
        topic="example_topic",
        channel="example_channel",
    )

    async for message in reader.messages():
        print(f"Message: {message.body}")
        await message.fin()

    await reader.close()


if __name__ == "__main__":
    asyncio.run(main())
```

### Producer

A simple producer sends a "Hello, world!" message to "example_topic".

```python
import asyncio

import ansq


async def main():
    writer = await ansq.create_writer()
    await writer.pub(
        topic="example_topic",
        message="Hello, world!",
    )
    await writer.close()


if __name__ == "__main__":
    asyncio.run(main())
```


## Contributing

Create and activate a development virtual environment.

```bash
python -m venv venv
source venv/bin/activate
```

Install `ansq` in editable mode and its testing dependencies.

```bash
python -m pip install -e .[testing]
```

Run tests.

```bash
pytest
```


%package help
Summary:	Development documents and examples for ansq
Provides:	python3-ansq-doc
%description help
# ansq - Async NSQ
[![PyPI version](https://badge.fury.io/py/ansq.svg)](https://badge.fury.io/py/ansq)
![Tests](https://github.com/list-family/ansq/workflows/Test/badge.svg)
[![Coverage](https://codecov.io/gh/list-family/ansq/branch/master/graph/badge.svg)](https://codecov.io/gh/list-family/ansq)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ansq)

Written with native Asyncio NSQ package

## Installation

```commandline
python -m pip install ansq
```

## Overview
- `Reader` — high-level class for building consumers with `nsqlookupd` support
- `Writer` — high-level producer class supporting async publishing of messages to `nsqd`
  over the TCP protocol
- `NSQConnection` — low-level class representing a TCP connection to `nsqd`:
    - full TCP wrapper
    - one connection for `sub` and `pub`
    - self-healing: when the connection is lost, reconnects, sends identify
      and auth commands, subscribes to previous topic/channel

## Features

- [x] SUB
- [x] PUB
- [x] Discovery
- [ ] Backoff
- [ ] TLS
- [ ] Deflate
- [ ] Snappy
- [x] Sampling
- [ ] AUTH

## Usage

### Consumer

A simple consumer reads messages from "example_topic" and prints them to stdout.

```python
import asyncio

import ansq


async def main():
    reader = await ansq.create_reader(
        topic="example_topic",
        channel="example_channel",
    )

    async for message in reader.messages():
        print(f"Message: {message.body}")
        await message.fin()

    await reader.close()


if __name__ == "__main__":
    asyncio.run(main())
```

### Producer

A simple producer sends a "Hello, world!" message to "example_topic".

```python
import asyncio

import ansq


async def main():
    writer = await ansq.create_writer()
    await writer.pub(
        topic="example_topic",
        message="Hello, world!",
    )
    await writer.close()


if __name__ == "__main__":
    asyncio.run(main())
```


## Contributing

Create and activate a development virtual environment.

```bash
python -m venv venv
source venv/bin/activate
```

Install `ansq` in editable mode and its testing dependencies.

```bash
python -m pip install -e .[testing]
```

Run tests.

```bash
pytest
```


%prep
%autosetup -n ansq-0.2.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-ansq -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Fri Jun 09 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.1-1
- Package Spec generated