Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-django-redis for openSUSE:Factory checked in at 2023-10-31 20:25:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-django-redis (Old) and /work/SRC/openSUSE:Factory/.python-django-redis.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-django-redis" Tue Oct 31 20:25:33 2023 rev:13 rq:1121341 version:5.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-django-redis/python-django-redis.changes 2023-07-03 17:42:17.280542871 +0200 +++ /work/SRC/openSUSE:Factory/.python-django-redis.new.17445/python-django-redis.changes 2023-10-31 20:25:47.406139137 +0100 @@ -1,0 +2,11 @@ +Tue Oct 31 02:05:32 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com> + +- Update to 5.4.0: + * Connection factory goes to cache options + * Added note in docs for correctly configuring hiredis parser when + using redis-py version 5. +- Add missing BuildRequires on redis +- Stop using globs in %files +- Switch to pyproject macros + +------------------------------------------------------------------- Old: ---- django-redis-5.3.0.tar.gz New: ---- django-redis-5.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-django-redis.spec ++++++ --- /var/tmp/diff_new_pack.kilmaE/_old 2023-10-31 20:25:47.954159266 +0100 +++ /var/tmp/diff_new_pack.kilmaE/_new 2023-10-31 20:25:47.954159266 +0100 @@ -18,27 +18,30 @@ %{?sle15_python_module_pythons} Name: python-django-redis -Version: 5.3.0 +Version: 5.4.0 Release: 0 Summary: A redis cache backend for Django License: BSD-3-Clause URL: https://github.com/jazzband/django-redis Source: https://files.pythonhosted.org/packages/source/d/django-redis/django-redis-%{version}.tar.gz -BuildRequires: %{python_module Django >= 2.2} +BuildRequires: %{python_module Django >= 3.2} BuildRequires: %{python_module lz4 >= 0.15} BuildRequires: %{python_module msgpack >= 0.4.6} +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest-django} BuildRequires: %{python_module pytest-mock >= 3.0} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module redis >= 2.10.0} +BuildRequires: %{python_module redis >= 3} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: psmisc BuildRequires: python-rpm-macros -Requires: python-Django >= 2.2 +BuildRequires: redis +Requires: python-Django >= 3.2 Requires: python-lz4 >= 0.15 Requires: python-msgpack >= 0.4.6 -Requires: python-redis >= 2.10.0 +Requires: python-redis >= 3 BuildArch: noarch %python_subpackages @@ -50,10 +53,10 @@ sed -i '/addopts/d' setup.cfg %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check @@ -72,5 +75,6 @@ %files %{python_files} %doc README.rst %license LICENSE -%{python_sitelib}/django[-_]redis*/ +%{python_sitelib}/django_redis +%{python_sitelib}/django_redis-%{version}.dist-info ++++++ django-redis-5.3.0.tar.gz -> django-redis-5.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/PKG-INFO new/django-redis-5.4.0/PKG-INFO --- old/django-redis-5.3.0/PKG-INFO 2023-06-16 14:13:06.367214400 +0200 +++ new/django-redis-5.4.0/PKG-INFO 2023-10-01 22:18:13.252378500 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: django-redis -Version: 5.3.0 +Version: 5.4.0 Summary: Full featured redis cache backend for Django. Home-page: https://github.com/jazzband/django-redis Author: Andrei Antoukh @@ -29,9 +29,12 @@ Classifier: Topic :: Utilities Requires-Python: >=3.6 Description-Content-Type: text/x-rst -Provides-Extra: hiredis License-File: LICENSE License-File: AUTHORS.rst +Requires-Dist: Django>=3.2 +Requires-Dist: redis!=4.0.0,!=4.0.1,>=3 +Provides-Extra: hiredis +Requires-Dist: redis[hiredis]!=4.0.0,!=4.0.1,>=3; extra == "hiredis" ============================== Redis cache backend for Django @@ -771,6 +774,35 @@ }, } +It is also possible to set some caches as sentinels and some as not: + +.. code-block:: python + + SENTINELS = [ + ('sentinel-1', 26379), + ('sentinel-2', 26379), + ('sentinel-3', 26379), + ] + CACHES = { + "sentinel": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://service_name/db", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.SentinelClient", + "SENTINELS": SENTINELS, + "CONNECTION_POOL_CLASS": "redis.sentinel.SentinelConnectionPool", + "CONNECTION_FACTORY": "django_redis.pool.SentinelConnectionFactory", + }, + }, + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://127.0.0.1:6379/1", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + }, + }, + } + .. _Redis Sentinels: https://redis.io/topics/sentinel Pluggable parsers @@ -789,6 +821,8 @@ "PARSER_CLASS": "redis.connection.HiredisParser", } +Note: if using version 5 of redis-py, use ``"redis.connection._HiredisParser"`` for the ``PARSER_CLASS`` due to an internal rename of classes within that package. + Pluggable clients ~~~~~~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/README.rst new/django-redis-5.4.0/README.rst --- old/django-redis-5.3.0/README.rst 2023-06-16 14:12:53.000000000 +0200 +++ new/django-redis-5.4.0/README.rst 2023-10-01 22:18:02.000000000 +0200 @@ -736,6 +736,35 @@ }, } +It is also possible to set some caches as sentinels and some as not: + +.. code-block:: python + + SENTINELS = [ + ('sentinel-1', 26379), + ('sentinel-2', 26379), + ('sentinel-3', 26379), + ] + CACHES = { + "sentinel": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://service_name/db", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.SentinelClient", + "SENTINELS": SENTINELS, + "CONNECTION_POOL_CLASS": "redis.sentinel.SentinelConnectionPool", + "CONNECTION_FACTORY": "django_redis.pool.SentinelConnectionFactory", + }, + }, + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://127.0.0.1:6379/1", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + }, + }, + } + .. _Redis Sentinels: https://redis.io/topics/sentinel Pluggable parsers @@ -754,6 +783,8 @@ "PARSER_CLASS": "redis.connection.HiredisParser", } +Note: if using version 5 of redis-py, use ``"redis.connection._HiredisParser"`` for the ``PARSER_CLASS`` due to an internal rename of classes within that package. + Pluggable clients ~~~~~~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/django_redis/__init__.py new/django-redis-5.4.0/django_redis/__init__.py --- old/django-redis-5.3.0/django_redis/__init__.py 2023-06-16 14:12:53.000000000 +0200 +++ new/django-redis-5.4.0/django_redis/__init__.py 2023-10-01 22:18:02.000000000 +0200 @@ -1,4 +1,4 @@ -VERSION = (5, 3, 0) +VERSION = (5, 4, 0) __version__ = ".".join(map(str, VERSION)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/django_redis/pool.py new/django-redis-5.4.0/django_redis/pool.py --- old/django-redis-5.3.0/django_redis/pool.py 2023-06-16 14:12:53.000000000 +0200 +++ new/django-redis-5.4.0/django_redis/pool.py 2023-10-01 22:18:02.000000000 +0200 @@ -184,6 +184,9 @@ "DJANGO_REDIS_CONNECTION_FACTORY", "django_redis.pool.ConnectionFactory", ) + opt_conn_factory = options.get("CONNECTION_FACTORY") + if opt_conn_factory: + path = opt_conn_factory cls = import_string(path) return cls(options or {}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/django_redis.egg-info/PKG-INFO new/django-redis-5.4.0/django_redis.egg-info/PKG-INFO --- old/django-redis-5.3.0/django_redis.egg-info/PKG-INFO 2023-06-16 14:13:06.000000000 +0200 +++ new/django-redis-5.4.0/django_redis.egg-info/PKG-INFO 2023-10-01 22:18:13.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: django-redis -Version: 5.3.0 +Version: 5.4.0 Summary: Full featured redis cache backend for Django. Home-page: https://github.com/jazzband/django-redis Author: Andrei Antoukh @@ -29,9 +29,12 @@ Classifier: Topic :: Utilities Requires-Python: >=3.6 Description-Content-Type: text/x-rst -Provides-Extra: hiredis License-File: LICENSE License-File: AUTHORS.rst +Requires-Dist: Django>=3.2 +Requires-Dist: redis!=4.0.0,!=4.0.1,>=3 +Provides-Extra: hiredis +Requires-Dist: redis[hiredis]!=4.0.0,!=4.0.1,>=3; extra == "hiredis" ============================== Redis cache backend for Django @@ -771,6 +774,35 @@ }, } +It is also possible to set some caches as sentinels and some as not: + +.. code-block:: python + + SENTINELS = [ + ('sentinel-1', 26379), + ('sentinel-2', 26379), + ('sentinel-3', 26379), + ] + CACHES = { + "sentinel": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://service_name/db", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.SentinelClient", + "SENTINELS": SENTINELS, + "CONNECTION_POOL_CLASS": "redis.sentinel.SentinelConnectionPool", + "CONNECTION_FACTORY": "django_redis.pool.SentinelConnectionFactory", + }, + }, + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://127.0.0.1:6379/1", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + }, + }, + } + .. _Redis Sentinels: https://redis.io/topics/sentinel Pluggable parsers @@ -789,6 +821,8 @@ "PARSER_CLASS": "redis.connection.HiredisParser", } +Note: if using version 5 of redis-py, use ``"redis.connection._HiredisParser"`` for the ``PARSER_CLASS`` due to an internal rename of classes within that package. + Pluggable clients ~~~~~~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/django_redis.egg-info/SOURCES.txt new/django-redis-5.4.0/django_redis.egg-info/SOURCES.txt --- old/django-redis-5.3.0/django_redis.egg-info/SOURCES.txt 2023-06-16 14:13:06.000000000 +0200 +++ new/django-redis-5.4.0/django_redis.egg-info/SOURCES.txt 2023-10-01 22:18:13.000000000 +0200 @@ -38,6 +38,7 @@ tests/test_backend.py tests/test_cache_options.py tests/test_client.py +tests/test_connection_factory.py tests/test_connection_string.py tests/test_hashring.py tests/test_serializers.py @@ -48,6 +49,7 @@ tests/settings/sqlite_lz4.py tests/settings/sqlite_msgpack.py tests/settings/sqlite_sentinel.py +tests/settings/sqlite_sentinel_opts.py tests/settings/sqlite_sharding.py tests/settings/sqlite_usock.py tests/settings/sqlite_zlib.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/setup.cfg new/django-redis-5.4.0/setup.cfg --- old/django-redis-5.3.0/setup.cfg 2023-06-16 14:13:06.371214400 +0200 +++ new/django-redis-5.4.0/setup.cfg 2023-10-01 22:18:13.256378700 +0200 @@ -104,6 +104,7 @@ {envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_lz4 {posargs} {envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_msgpack {posargs} {envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_sentinel {posargs} + {envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_sentinel_opts {posargs} {envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_sharding {posargs} {envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_usock {posargs} {envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_zlib {posargs} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/tests/settings/sqlite_sentinel_opts.py new/django-redis-5.4.0/tests/settings/sqlite_sentinel_opts.py --- old/django-redis-5.3.0/tests/settings/sqlite_sentinel_opts.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-redis-5.4.0/tests/settings/sqlite_sentinel_opts.py 2023-10-01 22:18:02.000000000 +0200 @@ -0,0 +1,49 @@ +SECRET_KEY = "django_tests_secret_key" + +SENTINELS = [("127.0.0.1", 26379)] + +conn_factory = "django_redis.pool.SentinelConnectionFactory" + +CACHES = { + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": ["redis://default_service?db=5"], + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + "SENTINELS": SENTINELS, + "CONNECTION_FACTORY": conn_factory, + }, + }, + "doesnotexist": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://missing_service?db=1", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + "SENTINELS": SENTINELS, + "CONNECTION_FACTORY": conn_factory, + }, + }, + "sample": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://default_service?db=1", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.SentinelClient", + "SENTINELS": SENTINELS, + "CONNECTION_FACTORY": conn_factory, + }, + }, + "with_prefix": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://default_service?db=1", + "KEY_PREFIX": "test-prefix", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + "SENTINELS": SENTINELS, + "CONNECTION_FACTORY": conn_factory, + }, + }, +} + +INSTALLED_APPS = ["django.contrib.sessions"] + +USE_TZ = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-redis-5.3.0/tests/test_connection_factory.py new/django-redis-5.4.0/tests/test_connection_factory.py --- old/django-redis-5.3.0/tests/test_connection_factory.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-redis-5.4.0/tests/test_connection_factory.py 2023-10-01 22:18:02.000000000 +0200 @@ -0,0 +1,60 @@ +import pytest +from django.core.exceptions import ImproperlyConfigured + +from django_redis import pool + + +def test_connection_factory_redefine_from_opts(): + cf = pool.get_connection_factory( + path="django_redis.pool.ConnectionFactory", + options={ + "CONNECTION_FACTORY": "django_redis.pool.SentinelConnectionFactory", + "SENTINELS": [("127.0.0.1", "26739")], + }, + ) + assert cf.__class__.__name__ == "SentinelConnectionFactory" + + +@pytest.mark.parametrize( + "conn_factory,expected", + [ + ("django_redis.pool.SentinelConnectionFactory", pool.SentinelConnectionFactory), + ("django_redis.pool.ConnectionFactory", pool.ConnectionFactory), + ], +) +def test_connection_factory_opts(conn_factory: str, expected): + cf = pool.get_connection_factory( + path=None, + options={ + "CONNECTION_FACTORY": conn_factory, + "SENTINELS": [("127.0.0.1", "26739")], + }, + ) + assert isinstance(cf, expected) + + +@pytest.mark.parametrize( + "conn_factory,expected", + [ + ("django_redis.pool.SentinelConnectionFactory", pool.SentinelConnectionFactory), + ("django_redis.pool.ConnectionFactory", pool.ConnectionFactory), + ], +) +def test_connection_factory_path(conn_factory: str, expected): + cf = pool.get_connection_factory( + path=conn_factory, + options={ + "SENTINELS": [("127.0.0.1", "26739")], + }, + ) + assert isinstance(cf, expected) + + +def test_connection_factory_no_sentinels(): + with pytest.raises(ImproperlyConfigured): + pool.get_connection_factory( + path=None, + options={ + "CONNECTION_FACTORY": "django_redis.pool.SentinelConnectionFactory", + }, + )