%global _empty_manifest_terminate_build 0 Name: python-ddb-cache Version: 0.6.0 Release: 1 Summary: A simple interface for caching items in DynamoDB License: LGPL-3.0-or-later URL: https://pypi.org/project/ddb-cache/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/73/13/22fe7afc4c0024266dd7f40053df696cb084ca5afa94fcd649b255ea2578/ddb-cache-0.6.0.tar.gz BuildArch: noarch Requires: python3-boto3 Requires: python3-pylib-helpers %description # ddb-cache A simple interface for caching items in DynamoDB ![License](https://img.shields.io/github/license/samarthj/py-ddbcache) [![Release](https://github.com/samarthj/py-ddbcache/actions/workflows/release.yml/badge.svg)](https://github.com/samarthj/py-ddbcache/actions/workflows/release.yml) [![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/samarthj/py-ddbcache?sort=semver)](https://github.com/samarthj/py-ddbcache/releases) [![PyPI](https://img.shields.io/pypi/v/ddb-cache)](https://pypi.org/project/ddb-cache/) [![Build](https://github.com/samarthj/py-ddbcache/actions/workflows/build_matrix.yml/badge.svg)](https://github.com/samarthj/py-ddbcache/actions/workflows/build_matrix.yml) [![codecov](https://codecov.io/gh/samarthj/py-ddbcache/branch/main/graph/badge.svg?token=9VCCD1BDNY)](https://codecov.io/gh/samarthj/py-ddbcache) [![Total alerts](https://img.shields.io/lgtm/alerts/g/samarthj/py-ddbcache.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/samarthj/py-ddbcache/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/samarthj/py-ddbcache.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/samarthj/py-ddbcache/context:python) [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) ## Example Usage Samples can be found here in the [tests](https://github.com/samarthj/py-ddbcache/blob/main/tests/test_ddbcache.py) The library can also be used for crud operations since it implement `get`, `put`, `update`, `delete`, `scan` and `query`. Along with `create_backup`. Basic usage is as given below: ```python def test_put_cache(ddb_cache: DDBCache): data = randint(1, 100) # noqa: S311 ddb_cache.put_cache({"id": "test_put_cache", "data": data}) item = ddb_cache.get_item({"id": "test_put_cache"}) assert item assert item["id"] == "test_put_cache" assert item["data"] == data assert item["ttl"] def test_put_cache_no_ttl(ddb_cache: DDBCache): data = randint(1, 100) # noqa: S311 ddb_cache.put_cache({"id": "test_put_cache", "data": data}, with_ttl=False) item = ddb_cache.get_item({"id": "test_put_cache"}) assert item assert item["id"] == "test_put_cache" assert item["data"] == data with pytest.raises(KeyError): item["ttl"] def test_fetch_cache(ddb_cache: DDBCache, init_cache): item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl = item["ttl"] assert ttl sleep(1) item = ddb_cache.fetch_cache({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" with pytest.raises(KeyError): item["ttl"] item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl2 = item["ttl"] assert ttl2 assert ttl != ttl2 def test_fetch_cache_no_ttl_update(ddb_cache: DDBCache, init_cache): item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl = item["ttl"] assert ttl item = ddb_cache.fetch_cache({"id": "test_fetch_cache"}, with_ttl=False) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" with pytest.raises(KeyError): item["ttl"] item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl2 = item["ttl"] assert ttl2 assert ttl == ttl2 ``` %package -n python3-ddb-cache Summary: A simple interface for caching items in DynamoDB Provides: python-ddb-cache BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-ddb-cache # ddb-cache A simple interface for caching items in DynamoDB ![License](https://img.shields.io/github/license/samarthj/py-ddbcache) [![Release](https://github.com/samarthj/py-ddbcache/actions/workflows/release.yml/badge.svg)](https://github.com/samarthj/py-ddbcache/actions/workflows/release.yml) [![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/samarthj/py-ddbcache?sort=semver)](https://github.com/samarthj/py-ddbcache/releases) [![PyPI](https://img.shields.io/pypi/v/ddb-cache)](https://pypi.org/project/ddb-cache/) [![Build](https://github.com/samarthj/py-ddbcache/actions/workflows/build_matrix.yml/badge.svg)](https://github.com/samarthj/py-ddbcache/actions/workflows/build_matrix.yml) [![codecov](https://codecov.io/gh/samarthj/py-ddbcache/branch/main/graph/badge.svg?token=9VCCD1BDNY)](https://codecov.io/gh/samarthj/py-ddbcache) [![Total alerts](https://img.shields.io/lgtm/alerts/g/samarthj/py-ddbcache.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/samarthj/py-ddbcache/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/samarthj/py-ddbcache.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/samarthj/py-ddbcache/context:python) [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) ## Example Usage Samples can be found here in the [tests](https://github.com/samarthj/py-ddbcache/blob/main/tests/test_ddbcache.py) The library can also be used for crud operations since it implement `get`, `put`, `update`, `delete`, `scan` and `query`. Along with `create_backup`. Basic usage is as given below: ```python def test_put_cache(ddb_cache: DDBCache): data = randint(1, 100) # noqa: S311 ddb_cache.put_cache({"id": "test_put_cache", "data": data}) item = ddb_cache.get_item({"id": "test_put_cache"}) assert item assert item["id"] == "test_put_cache" assert item["data"] == data assert item["ttl"] def test_put_cache_no_ttl(ddb_cache: DDBCache): data = randint(1, 100) # noqa: S311 ddb_cache.put_cache({"id": "test_put_cache", "data": data}, with_ttl=False) item = ddb_cache.get_item({"id": "test_put_cache"}) assert item assert item["id"] == "test_put_cache" assert item["data"] == data with pytest.raises(KeyError): item["ttl"] def test_fetch_cache(ddb_cache: DDBCache, init_cache): item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl = item["ttl"] assert ttl sleep(1) item = ddb_cache.fetch_cache({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" with pytest.raises(KeyError): item["ttl"] item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl2 = item["ttl"] assert ttl2 assert ttl != ttl2 def test_fetch_cache_no_ttl_update(ddb_cache: DDBCache, init_cache): item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl = item["ttl"] assert ttl item = ddb_cache.fetch_cache({"id": "test_fetch_cache"}, with_ttl=False) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" with pytest.raises(KeyError): item["ttl"] item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl2 = item["ttl"] assert ttl2 assert ttl == ttl2 ``` %package help Summary: Development documents and examples for ddb-cache Provides: python3-ddb-cache-doc %description help # ddb-cache A simple interface for caching items in DynamoDB ![License](https://img.shields.io/github/license/samarthj/py-ddbcache) [![Release](https://github.com/samarthj/py-ddbcache/actions/workflows/release.yml/badge.svg)](https://github.com/samarthj/py-ddbcache/actions/workflows/release.yml) [![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/samarthj/py-ddbcache?sort=semver)](https://github.com/samarthj/py-ddbcache/releases) [![PyPI](https://img.shields.io/pypi/v/ddb-cache)](https://pypi.org/project/ddb-cache/) [![Build](https://github.com/samarthj/py-ddbcache/actions/workflows/build_matrix.yml/badge.svg)](https://github.com/samarthj/py-ddbcache/actions/workflows/build_matrix.yml) [![codecov](https://codecov.io/gh/samarthj/py-ddbcache/branch/main/graph/badge.svg?token=9VCCD1BDNY)](https://codecov.io/gh/samarthj/py-ddbcache) [![Total alerts](https://img.shields.io/lgtm/alerts/g/samarthj/py-ddbcache.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/samarthj/py-ddbcache/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/samarthj/py-ddbcache.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/samarthj/py-ddbcache/context:python) [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) ## Example Usage Samples can be found here in the [tests](https://github.com/samarthj/py-ddbcache/blob/main/tests/test_ddbcache.py) The library can also be used for crud operations since it implement `get`, `put`, `update`, `delete`, `scan` and `query`. Along with `create_backup`. Basic usage is as given below: ```python def test_put_cache(ddb_cache: DDBCache): data = randint(1, 100) # noqa: S311 ddb_cache.put_cache({"id": "test_put_cache", "data": data}) item = ddb_cache.get_item({"id": "test_put_cache"}) assert item assert item["id"] == "test_put_cache" assert item["data"] == data assert item["ttl"] def test_put_cache_no_ttl(ddb_cache: DDBCache): data = randint(1, 100) # noqa: S311 ddb_cache.put_cache({"id": "test_put_cache", "data": data}, with_ttl=False) item = ddb_cache.get_item({"id": "test_put_cache"}) assert item assert item["id"] == "test_put_cache" assert item["data"] == data with pytest.raises(KeyError): item["ttl"] def test_fetch_cache(ddb_cache: DDBCache, init_cache): item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl = item["ttl"] assert ttl sleep(1) item = ddb_cache.fetch_cache({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" with pytest.raises(KeyError): item["ttl"] item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl2 = item["ttl"] assert ttl2 assert ttl != ttl2 def test_fetch_cache_no_ttl_update(ddb_cache: DDBCache, init_cache): item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl = item["ttl"] assert ttl item = ddb_cache.fetch_cache({"id": "test_fetch_cache"}, with_ttl=False) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" with pytest.raises(KeyError): item["ttl"] item = ddb_cache.get_item({"id": "test_fetch_cache"}) assert item assert item["id"] == "test_fetch_cache" assert item["data"] == "test_fetch_cache" ttl2 = item["ttl"] assert ttl2 assert ttl == ttl2 ``` %prep %autosetup -n ddb-cache-0.6.0 %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-ddb-cache -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Wed May 10 2023 Python_Bot - 0.6.0-1 - Package Spec generated