Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-dogpile.cache for openSUSE:Factory checked in at 2024-05-06 17:54:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-dogpile.cache (Old) and /work/SRC/openSUSE:Factory/.python-dogpile.cache.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-dogpile.cache" Mon May 6 17:54:51 2024 rev:43 rq:1172118 version:1.3.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-dogpile.cache/python-dogpile.cache.changes 2024-03-18 16:47:52.482295886 +0100 +++ /work/SRC/openSUSE:Factory/.python-dogpile.cache.new.1880/python-dogpile.cache.changes 2024-05-06 17:56:11.661512460 +0200 @@ -1,0 +2,14 @@ +Mon May 6 08:35:52 UTC 2024 - Dirk Müller <dmuel...@suse.com> + +- update to 1.3.3: + * Added support for an additional pymemcached client parameter + PyMemcacheBackend.memcached_expire_time + * Fixed the return type for CacheRegion.get(), which was + inadvertently hardcoded to use CacheReturnType that only + resolved to CachedValue or NoValue. Fixed to return + ValuePayload which resolves to Any, as well as a new literal + indicating an enum constant for :data:.api.NO_VALUE. The + :data:.api.NO_VALUE constant remains available as the single + element of this enum. + +------------------------------------------------------------------- Old: ---- dogpile.cache-1.3.2.tar.gz New: ---- dogpile.cache-1.3.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-dogpile.cache.spec ++++++ --- /var/tmp/diff_new_pack.4pDMQH/_old 2024-05-06 17:56:12.129529498 +0200 +++ /var/tmp/diff_new_pack.4pDMQH/_new 2024-05-06 17:56:12.129529498 +0200 @@ -18,14 +18,14 @@ %{?sle15_python_module_pythons} Name: python-dogpile.cache -Version: 1.3.2 +Version: 1.3.3 Release: 0 %define modname dogpile.cache -%define modver 1_3_2 +%define modver 1_3_3 Summary: A caching front-end based on the Dogpile lock License: BSD-3-Clause URL: https://github.com/sqlalchemy/dogpile.cache -Source: https://github.com/sqlalchemy/%{modname}/archive/rel_%{modver}.tar.gz#/%{modname}-%{version}.tar.gz +Source: https://github.com/sqlalchemy/%{modname}/archive/refs/tags/rel_%{modver}.tar.gz#/%{modname}-%{version}.tar.gz BuildRequires: %{python_module Mako} BuildRequires: %{python_module dbm} BuildRequires: %{python_module decorator >= 4.0.0} ++++++ dogpile.cache-1.3.2.tar.gz -> dogpile.cache-1.3.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/docs/build/changelog.rst new/dogpile.cache-rel_1_3_3/docs/build/changelog.rst --- old/dogpile.cache-rel_1_3_2/docs/build/changelog.rst 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/docs/build/changelog.rst 2024-05-05 18:53:11.000000000 +0200 @@ -3,6 +3,27 @@ ========= .. changelog:: + :version: 1.3.3 + :released: Sun May 5 2024 + + .. change:: + :tags: bug, typing + + Fixed the return type for :meth:`.CacheRegion.get`, which was inadvertently + hardcoded to use ``CacheReturnType`` that only resolved to ``CachedValue`` + or ``NoValue``. Fixed to return ``ValuePayload`` which resolves to + ``Any``, as well as a new literal indicating an enum constant for + :data:`.api.NO_VALUE`. The :data:`.api.NO_VALUE` constant remains + available as the single element of this enum. + + .. change:: + :tags: usecase, memcached + + Added support for an additional pymemcached client parameter + :paramref:`.PyMemcacheBackend.memcached_expire_time`. Pull request + courtesy Takashi Kajinami. + +.. changelog:: :version: 1.3.2 :released: Wed Feb 21 2024 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/docs/build/conf.py new/dogpile.cache-rel_1_3_3/docs/build/conf.py --- old/dogpile.cache-rel_1_3_2/docs/build/conf.py 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/docs/build/conf.py 2024-05-05 18:53:11.000000000 +0200 @@ -74,7 +74,7 @@ # The short X.Y version. version = dogpile.__version__ # The full version, including alpha/beta/rc tags. -release = "1.3.2" +release = "1.3.3" # The language for content autogenerated by Sphinx. Refer to documentation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/dogpile/__init__.py new/dogpile.cache-rel_1_3_3/dogpile/__init__.py --- old/dogpile.cache-rel_1_3_2/dogpile/__init__.py 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/dogpile/__init__.py 2024-05-05 18:53:11.000000000 +0200 @@ -1,4 +1,4 @@ -__version__ = "1.3.2" +__version__ = "1.3.3" from .lock import Lock # noqa from .lock import NeedRegenerationException # noqa diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/dogpile/cache/api.py new/dogpile.cache-rel_1_3_3/dogpile/cache/api.py --- old/dogpile.cache-rel_1_3_2/dogpile/cache/api.py 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/dogpile/cache/api.py 2024-05-05 18:53:11.000000000 +0200 @@ -1,11 +1,13 @@ from __future__ import annotations import abc +import enum import pickle import time from typing import Any from typing import Callable from typing import cast +from typing import Literal from typing import Mapping from typing import NamedTuple from typing import Optional @@ -15,7 +17,7 @@ from ..util.typing import Self -class NoValue: +class NoValue(enum.Enum): """Describe a missing cache value. The :data:`.NO_VALUE` constant should be used. @@ -33,12 +35,16 @@ """ return "<dogpile.cache.api.NoValue object>" - def __bool__(self): # pragma NO COVERAGE + def __bool__(self) -> Literal[False]: # pragma NO COVERAGE return False + NO_VALUE = "NoValue" -NO_VALUE = NoValue() -"""Value returned from ``get()`` that describes + +NoValueType = Literal[NoValue.NO_VALUE] + +NO_VALUE = NoValue.NO_VALUE +"""Value returned from :meth:`.CacheRegion.get` that describes a key not present.""" MetaDataType = Mapping[str, Any] @@ -160,13 +166,13 @@ return time.time() - self.cached_time -CacheReturnType = Union[CachedValue, NoValue] +CacheReturnType = Union[CachedValue, NoValueType] """The non-serialized form of what may be returned from a backend get method. """ -SerializedReturnType = Union[bytes, NoValue] +SerializedReturnType = Union[bytes, NoValueType] """the serialized form of what may be returned from a backend get method.""" BackendFormatted = Union[CacheReturnType, SerializedReturnType] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/dogpile/cache/backends/memcached.py new/dogpile.cache-rel_1_3_3/dogpile/cache/backends/memcached.py --- old/dogpile.cache-rel_1_3_2/dogpile/cache/backends/memcached.py 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/dogpile/cache/backends/memcached.py 2024-05-05 18:53:11.000000000 +0200 @@ -95,26 +95,6 @@ .. versionadded:: 0.5.7 - :param memcached_expire_time: integer, when present will - be passed as the ``time`` parameter to ``pylibmc.Client.set``. - This is used to set the memcached expiry time for a value. - - .. note:: - - This parameter is **different** from Dogpile's own - ``expiration_time``, which is the number of seconds after - which Dogpile will consider the value to be expired. - When Dogpile considers a value to be expired, - it **continues to use the value** until generation - of a new value is complete, when using - :meth:`.CacheRegion.get_or_create`. - Therefore, if you are setting ``memcached_expire_time``, you'll - want to make sure it is greater than ``expiration_time`` - by at least enough seconds for new values to be generated, - else the value won't be available during a regeneration, - forcing all threads to wait for a regeneration each time - a value expires. - The :class:`.GenericMemachedBackend` uses a ``threading.local()`` object to store individual client objects per thread, as most modern memcached clients do not appear to be inherently @@ -147,7 +127,6 @@ self.url = util.to_list(arguments["url"]) self.distributed_lock = arguments.get("distributed_lock", False) self.lock_timeout = arguments.get("lock_timeout", 0) - self.memcached_expire_time = arguments.get("memcached_expire_time", 0) def has_lock_timeout(self): return self.lock_timeout != 0 @@ -222,6 +201,29 @@ class MemcacheArgs(GenericMemcachedBackend): """Mixin which provides support for the 'time' argument to set(), 'min_compress_len' to other methods. + + :param memcached_expire_time: integer, when present will + be passed as the ``time`` parameter to the ``set`` method. + This is used to set the memcached expiry time for a value. + + .. note:: + + This parameter is **different** from Dogpile's own + ``expiration_time``, which is the number of seconds after + which Dogpile will consider the value to be expired. + When Dogpile considers a value to be expired, + it **continues to use the value** until generation + of a new value is complete, when using + :meth:`.CacheRegion.get_or_create`. + Therefore, if you are setting ``memcached_expire_time``, you'll + want to make sure it is greater than ``expiration_time`` + by at least enough seconds for new values to be generated, + else the value won't be available during a regeneration, + forcing all threads to wait for a regeneration each time + a value expires. + + :param min_compress_len: Threshold length to kick in auto-compression + of the value using the compressor """ def __init__(self, arguments): @@ -408,25 +410,8 @@ global bmemcached import bmemcached - class RepairBMemcachedAPI(bmemcached.Client): - """Repairs BMemcached's non-standard method - signatures, which was fixed in BMemcached - ef206ed4473fec3b639e. - - """ - - def add(self, key, value, timeout=0): - try: - return super(RepairBMemcachedAPI, self).add( - key, value, timeout - ) - except ValueError: - return False - - self.Client = RepairBMemcachedAPI - def _create_client(self): - return self.Client( + return bmemcached.Client( self.url, username=self.username, password=self.password, @@ -580,6 +565,28 @@ .. versionadded:: 1.1.5 + :param memcached_expire_time: integer, when present will + be passed as the ``time`` parameter to the ``set`` method. + This is used to set the memcached expiry time for a value. + + .. note:: + + This parameter is **different** from Dogpile's own + ``expiration_time``, which is the number of seconds after + which Dogpile will consider the value to be expired. + When Dogpile considers a value to be expired, + it **continues to use the value** until generation + of a new value is complete, when using + :meth:`.CacheRegion.get_or_create`. + Therefore, if you are setting ``memcached_expire_time``, you'll + want to make sure it is greater than ``expiration_time`` + by at least enough seconds for new values to be generated, + else the value won't be available during a regeneration, + forcing all threads to wait for a regeneration each time + a value expires. + + .. versionadded:: 1.3.3 + """ # noqa E501 def __init__(self, arguments): @@ -611,6 +618,9 @@ "enable_retry_client is not set; retry options " "will be ignored" ) + self.set_arguments = {} + if "memcached_expire_time" in arguments: + self.set_arguments["expire"] = arguments["memcached_expire_time"] def _imports(self): global pymemcache diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/dogpile/cache/region.py new/dogpile.cache-rel_1_3_3/dogpile/cache/region.py --- old/dogpile.cache-rel_1_3_2/dogpile/cache/region.py 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/dogpile/cache/region.py 2024-05-05 18:53:11.000000000 +0200 @@ -32,6 +32,7 @@ from .api import KeyType from .api import MetaDataType from .api import NO_VALUE +from .api import NoValueType from .api import SerializedReturnType from .api import Serializer from .api import ValuePayload @@ -706,19 +707,20 @@ key: KeyType, expiration_time: Optional[float] = None, ignore_expiration: bool = False, - ) -> CacheReturnType: + ) -> Union[ValuePayload, NoValueType]: """Return a value from the cache, based on the given key. If the value is not present, the method returns the token - ``NO_VALUE``. ``NO_VALUE`` evaluates to False, but is separate from - ``None`` to distinguish between a cached value of ``None``. + :data:`.api.NO_VALUE`. :data:`.api.NO_VALUE` evaluates to False, but is + separate from ``None`` to distinguish between a cached value of + ``None``. By default, the configured expiration time of the :class:`.CacheRegion`, or alternatively the expiration time supplied by the ``expiration_time`` argument, is tested against the creation time of the retrieved value versus the current time (as reported by ``time.time()``). - If stale, the cached value is ignored and the ``NO_VALUE`` + If stale, the cached value is ignored and the :data:`.api.NO_VALUE` token is returned. Passing the flag ``ignore_expiration=True`` bypasses the expiration time check. @@ -731,7 +733,7 @@ of the current "invalidation" time as set by the :meth:`.invalidate` method. If a value is present, but its creation time is older than the current - invalidation time, the ``NO_VALUE`` token is returned. + invalidation time, the :data:`.api.NO_VALUE` token is returned. Passing the flag ``ignore_expiration=True`` bypasses the invalidation time check. @@ -1083,7 +1085,7 @@ return creator(*ca[0], **ca[1]) else: - go = creator + go = creator # type: ignore return acr(self, orig_key, go, mutex) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/setup.cfg new/dogpile.cache-rel_1_3_3/setup.cfg --- old/dogpile.cache-rel_1_3_2/setup.cfg 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/setup.cfg 2024-05-05 18:53:11.000000000 +0200 @@ -2,7 +2,7 @@ enable-extensions = G # E203 is due to https://github.com/PyCQA/pycodestyle/issues/373 ignore = - A003, + A003,A005 D, E203,E305,E711,E712,E721,E722,E741, N801,N802,N806, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/tests/cache/test_memcached_backend.py new/dogpile.cache-rel_1_3_3/tests/cache/test_memcached_backend.py --- old/dogpile.cache-rel_1_3_2/tests/cache/test_memcached_backend.py 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/tests/cache/test_memcached_backend.py 2024-05-05 18:53:11.000000000 +0200 @@ -345,6 +345,16 @@ ), ) + def test_pymemcache_memacached_expire_time(self): + config_args = {"url": "127.0.0.1:11211", "memcached_expire_time": 20} + with self._mock_pymemcache_fixture(): + backend = MockPyMemcacheBackend(config_args) + backend.set("foo", "bar") + eq_( + self.hash_client().set.mock_calls, + [mock.call("foo", "bar", expire=20)], + ) + class MemcachedTest(_NonDistributedMemcachedTestSuite): backend = "dogpile.cache.memcached" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dogpile.cache-rel_1_3_2/tests/cache/test_region.py new/dogpile.cache-rel_1_3_3/tests/cache/test_region.py --- old/dogpile.cache-rel_1_3_2/tests/cache/test_region.py 2024-02-21 20:40:59.000000000 +0100 +++ new/dogpile.cache-rel_1_3_3/tests/cache/test_region.py 2024-05-05 18:53:11.000000000 +0200 @@ -30,7 +30,7 @@ class APITest: def test_no_value_str(self): - eq_(str(NO_VALUE), "<dogpile.cache.api.NoValue object>") + eq_(str(NO_VALUE), "NoValue.NO_VALUE") class RegionTest: