diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-redisbloom.spec | 307 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 309 insertions, 0 deletions
@@ -0,0 +1 @@ +/redisbloom-0.4.1.tar.gz diff --git a/python-redisbloom.spec b/python-redisbloom.spec new file mode 100644 index 0000000..06442e0 --- /dev/null +++ b/python-redisbloom.spec @@ -0,0 +1,307 @@ +%global _empty_manifest_terminate_build 0 +Name: python-redisbloom +Version: 0.4.1 +Release: 1 +Summary: RedisBloom Python Client +License: BSD-3-Clause +URL: https://pypi.org/project/redisbloom/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/4a/4b/c0daf17027c22414a2b27cb1e3b0366cac3e721c6eaad4b79b7d921cb919/redisbloom-0.4.1.tar.gz +BuildArch: noarch + +Requires: python3-hiredis +Requires: python3-redis +Requires: python3-rmtest +Requires: python3-six + +%description +[](https://github.com/RedisBloom/redisbloom-py) +[](https://badge.fury.io/py/redisbloom) +[](https://circleci.com/gh/RedisBloom/redisbloom-py/tree/master) +[](https://github.com/RedisBloom/redisbloom-py/releases/latest) +[](https://codecov.io/gh/RedisBloom/redisbloom-py) +[](https://snyk.io/test/github/RedisBloom/redisbloom-py?targetFile=pyproject.toml) +[](https://lgtm.com/projects/g/RedisBloom/redisbloom-py/alerts/) + +# Python client for RedisBloom +[](https://forum.redis.com/c/modules/redisbloom) +[](https://discord.gg/wXhwjCQ) + +redisbloom-py is a package that gives developers easy access to several probabilistic data structures. The package extends [redis-py](https://github.com/andymccurdy/redis-py)'s interface with RedisBloom's API. + +### Installation +``` +$ pip install redisbloom +``` + +### Usage example + +```python +# Using Bloom Filter +from redisbloom.client import Client +rb = Client() +rb.bfCreate('bloom', 0.01, 1000) +rb.bfAdd('bloom', 'foo') # returns 1 +rb.bfAdd('bloom', 'foo') # returns 0 +rb.bfExists('bloom', 'foo') # returns 1 +rb.bfExists('bloom', 'noexist') # returns 0 + +# Using Cuckoo Filter +from redisbloom.client import Client +rb = Client() +rb.cfCreate('cuckoo', 1000) +rb.cfAdd('cuckoo', 'filter') # returns 1 +rb.cfAddNX('cuckoo', 'filter') # returns 0 +rb.cfExists('cuckoo', 'filter') # returns 1 +rb.cfExists('cuckoo', 'noexist') # returns 0 + +# Using Count-Min Sketch +from redisbloom.client import Client +rb = Client() +rb.cmsInitByDim('dim', 1000, 5) +rb.cmsIncrBy('dim', ['foo'], [5]) +rb.cmsIncrBy('dim', ['foo', 'bar'], [5, 15]) +rb.cmsQuery('dim', 'foo', 'bar') # returns [10, 15] + +# Using Top-K +from redisbloom.client import Client +rb = Client() +rb.topkReserve('topk', 3, 20, 3, 0.9) +rb.topkAdd('topk', 'A', 'B', 'C', 'D', 'E', 'A', 'A', 'B', + 'C', 'G', 'D', 'B', 'D', 'A', 'E', 'E') +rb.topkQuery('topk', 'A', 'B', 'C', 'D') # returns [1, 1, 0, 1] +rb.topkCount('topk', 'A', 'B', 'C', 'D') # returns [4, 3, 2, 3] +rb.topkList('topk') # returns ['A', 'B', 'E'] +rb.topkListWithCount('topk') # returns ['A', 4, 'B', 3, 'E', 3] +``` + +### API +For complete documentation about RedisBloom's commands, refer to [RedisBloom's website](http://redisbloom.io). + +### License +[BSD 3-Clause](https://github.com/RedisBloom/redisbloom-py/blob/master/LICENSE) + +### Development + +1. Create a virtualenv to manage your python dependencies, and ensure it's active. + ```virtualenv -v venv``` +2. Install [pypoetry](https://python-poetry.org/) to manage your dependencies. + ```pip install poetry``` +3. Install dependencies. + ```poetry install``` + +[tox](https://tox.readthedocs.io/en/latest/) runs all tests as its default target. Running *tox* by itself will run unit tests. Ensure you have a running redis, with the module loaded. + + + +%package -n python3-redisbloom +Summary: RedisBloom Python Client +Provides: python-redisbloom +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-redisbloom +[](https://github.com/RedisBloom/redisbloom-py) +[](https://badge.fury.io/py/redisbloom) +[](https://circleci.com/gh/RedisBloom/redisbloom-py/tree/master) +[](https://github.com/RedisBloom/redisbloom-py/releases/latest) +[](https://codecov.io/gh/RedisBloom/redisbloom-py) +[](https://snyk.io/test/github/RedisBloom/redisbloom-py?targetFile=pyproject.toml) +[](https://lgtm.com/projects/g/RedisBloom/redisbloom-py/alerts/) + +# Python client for RedisBloom +[](https://forum.redis.com/c/modules/redisbloom) +[](https://discord.gg/wXhwjCQ) + +redisbloom-py is a package that gives developers easy access to several probabilistic data structures. The package extends [redis-py](https://github.com/andymccurdy/redis-py)'s interface with RedisBloom's API. + +### Installation +``` +$ pip install redisbloom +``` + +### Usage example + +```python +# Using Bloom Filter +from redisbloom.client import Client +rb = Client() +rb.bfCreate('bloom', 0.01, 1000) +rb.bfAdd('bloom', 'foo') # returns 1 +rb.bfAdd('bloom', 'foo') # returns 0 +rb.bfExists('bloom', 'foo') # returns 1 +rb.bfExists('bloom', 'noexist') # returns 0 + +# Using Cuckoo Filter +from redisbloom.client import Client +rb = Client() +rb.cfCreate('cuckoo', 1000) +rb.cfAdd('cuckoo', 'filter') # returns 1 +rb.cfAddNX('cuckoo', 'filter') # returns 0 +rb.cfExists('cuckoo', 'filter') # returns 1 +rb.cfExists('cuckoo', 'noexist') # returns 0 + +# Using Count-Min Sketch +from redisbloom.client import Client +rb = Client() +rb.cmsInitByDim('dim', 1000, 5) +rb.cmsIncrBy('dim', ['foo'], [5]) +rb.cmsIncrBy('dim', ['foo', 'bar'], [5, 15]) +rb.cmsQuery('dim', 'foo', 'bar') # returns [10, 15] + +# Using Top-K +from redisbloom.client import Client +rb = Client() +rb.topkReserve('topk', 3, 20, 3, 0.9) +rb.topkAdd('topk', 'A', 'B', 'C', 'D', 'E', 'A', 'A', 'B', + 'C', 'G', 'D', 'B', 'D', 'A', 'E', 'E') +rb.topkQuery('topk', 'A', 'B', 'C', 'D') # returns [1, 1, 0, 1] +rb.topkCount('topk', 'A', 'B', 'C', 'D') # returns [4, 3, 2, 3] +rb.topkList('topk') # returns ['A', 'B', 'E'] +rb.topkListWithCount('topk') # returns ['A', 4, 'B', 3, 'E', 3] +``` + +### API +For complete documentation about RedisBloom's commands, refer to [RedisBloom's website](http://redisbloom.io). + +### License +[BSD 3-Clause](https://github.com/RedisBloom/redisbloom-py/blob/master/LICENSE) + +### Development + +1. Create a virtualenv to manage your python dependencies, and ensure it's active. + ```virtualenv -v venv``` +2. Install [pypoetry](https://python-poetry.org/) to manage your dependencies. + ```pip install poetry``` +3. Install dependencies. + ```poetry install``` + +[tox](https://tox.readthedocs.io/en/latest/) runs all tests as its default target. Running *tox* by itself will run unit tests. Ensure you have a running redis, with the module loaded. + + + +%package help +Summary: Development documents and examples for redisbloom +Provides: python3-redisbloom-doc +%description help +[](https://github.com/RedisBloom/redisbloom-py) +[](https://badge.fury.io/py/redisbloom) +[](https://circleci.com/gh/RedisBloom/redisbloom-py/tree/master) +[](https://github.com/RedisBloom/redisbloom-py/releases/latest) +[](https://codecov.io/gh/RedisBloom/redisbloom-py) +[](https://snyk.io/test/github/RedisBloom/redisbloom-py?targetFile=pyproject.toml) +[](https://lgtm.com/projects/g/RedisBloom/redisbloom-py/alerts/) + +# Python client for RedisBloom +[](https://forum.redis.com/c/modules/redisbloom) +[](https://discord.gg/wXhwjCQ) + +redisbloom-py is a package that gives developers easy access to several probabilistic data structures. The package extends [redis-py](https://github.com/andymccurdy/redis-py)'s interface with RedisBloom's API. + +### Installation +``` +$ pip install redisbloom +``` + +### Usage example + +```python +# Using Bloom Filter +from redisbloom.client import Client +rb = Client() +rb.bfCreate('bloom', 0.01, 1000) +rb.bfAdd('bloom', 'foo') # returns 1 +rb.bfAdd('bloom', 'foo') # returns 0 +rb.bfExists('bloom', 'foo') # returns 1 +rb.bfExists('bloom', 'noexist') # returns 0 + +# Using Cuckoo Filter +from redisbloom.client import Client +rb = Client() +rb.cfCreate('cuckoo', 1000) +rb.cfAdd('cuckoo', 'filter') # returns 1 +rb.cfAddNX('cuckoo', 'filter') # returns 0 +rb.cfExists('cuckoo', 'filter') # returns 1 +rb.cfExists('cuckoo', 'noexist') # returns 0 + +# Using Count-Min Sketch +from redisbloom.client import Client +rb = Client() +rb.cmsInitByDim('dim', 1000, 5) +rb.cmsIncrBy('dim', ['foo'], [5]) +rb.cmsIncrBy('dim', ['foo', 'bar'], [5, 15]) +rb.cmsQuery('dim', 'foo', 'bar') # returns [10, 15] + +# Using Top-K +from redisbloom.client import Client +rb = Client() +rb.topkReserve('topk', 3, 20, 3, 0.9) +rb.topkAdd('topk', 'A', 'B', 'C', 'D', 'E', 'A', 'A', 'B', + 'C', 'G', 'D', 'B', 'D', 'A', 'E', 'E') +rb.topkQuery('topk', 'A', 'B', 'C', 'D') # returns [1, 1, 0, 1] +rb.topkCount('topk', 'A', 'B', 'C', 'D') # returns [4, 3, 2, 3] +rb.topkList('topk') # returns ['A', 'B', 'E'] +rb.topkListWithCount('topk') # returns ['A', 4, 'B', 3, 'E', 3] +``` + +### API +For complete documentation about RedisBloom's commands, refer to [RedisBloom's website](http://redisbloom.io). + +### License +[BSD 3-Clause](https://github.com/RedisBloom/redisbloom-py/blob/master/LICENSE) + +### Development + +1. Create a virtualenv to manage your python dependencies, and ensure it's active. + ```virtualenv -v venv``` +2. Install [pypoetry](https://python-poetry.org/) to manage your dependencies. + ```pip install poetry``` +3. Install dependencies. + ```poetry install``` + +[tox](https://tox.readthedocs.io/en/latest/) runs all tests as its default target. Running *tox* by itself will run unit tests. Ensure you have a running redis, with the module loaded. + + + +%prep +%autosetup -n redisbloom-0.4.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-redisbloom -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.1-1 +- Package Spec generated @@ -0,0 +1 @@ +193bd5dede748efdbe81b2eca0420226 redisbloom-0.4.1.tar.gz |