diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69d170705..bd1d6d334 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] - django-version: ['2.2', '3.1', '3.2'] + python-version: ['3.7', '3.8', '3.9', '3.10'] + django-version: ['2.2', '3.2', '4.0'] + exclude: + - python-version: '3.10' + django-version: '2.2' + - python-version: '3.7' + django-version: '4.0' services: redis: @@ -66,7 +71,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y libmemcached-dev zlib1g-dev - python -m pip install --upgrade pip + python -m pip install --upgrade pip wheel python -m pip install tox tox-gh-actions coveralls - name: Tox Test run: tox diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index 705cbf023..65368aceb 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -15,7 +15,7 @@ jobs: services: redis: - image: redis:6.0 + image: redis:6 ports: - 6379:6379 postgres: @@ -64,7 +64,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y libmemcached-dev zlib1g-dev - python -m pip install --upgrade pip + python -m pip install --upgrade pip wheel python -m pip install tox tox-gh-actions coveralls - name: Tox Test run: tox diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b8cadb94a..16e8e81d8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ What’s new in django-cachalot? ============================== +2.4.5 +----- + +- Dropped Python 3.6 and Django 3.1 support. Added Django 4.0 support (#208) + 2.4.4 ----- diff --git a/README.rst b/README.rst index 4ae099bfd..48fc720c1 100644 --- a/README.rst +++ b/README.rst @@ -39,7 +39,7 @@ Table of Contents: Quickstart ---------- -Cachalot officially supports Python 3.6-3.9 and Django 2.2 and 3.1-3.2 with the databases PostgreSQL, SQLite, and MySQL. +Cachalot officially supports Python 3.7-3.10 and Django 2.2, 3.2, and 4.0 with the databases PostgreSQL, SQLite, and MySQL. Note: an upper limit on Django version is set for your safety. Please do not ignore it. diff --git a/cachalot/__init__.py b/cachalot/__init__.py index bcf1ab22d..a14f00d3f 100644 --- a/cachalot/__init__.py +++ b/cachalot/__init__.py @@ -1,4 +1,4 @@ -VERSION = (2, 4, 4) +VERSION = (2, 4, 5) __version__ = ".".join(map(str, VERSION)) try: diff --git a/cachalot/tests/migrations/0001_initial.py b/cachalot/tests/migrations/0001_initial.py index a44349628..45b4f87d3 100644 --- a/cachalot/tests/migrations/0001_initial.py +++ b/cachalot/tests/migrations/0001_initial.py @@ -1,3 +1,4 @@ +from django import VERSION as DJANGO_VERSION from django.conf import settings from django.contrib.postgres.fields import ( ArrayField, HStoreField, IntegerRangeField, @@ -10,11 +11,8 @@ def extra_regular_available_fields(): fields = [] try: - # TODO Add to module import when Dj40 dropped - from django import VERSION as DJANGO_VERSION - from django.contrib.postgres.fields import JSONField - if float(".".join(map(str, DJANGO_VERSION[:2]))) > 3.0: - fields.append(('json', JSONField(null=True, blank=True))) + from django.db.models import JSONField + fields.append(('json', JSONField(null=True, blank=True))) except ImportError: pass @@ -38,12 +36,10 @@ def extra_postgres_available_fields(): pass # Future proofing with Django 40 deprecation - try: + if DJANGO_VERSION[0] < 4: # TODO Remove when Dj40 support is dropped from django.contrib.postgres.fields import JSONField fields.append(('json', JSONField(null=True, blank=True))) - except ImportError: - pass return fields diff --git a/cachalot/tests/models.py b/cachalot/tests/models.py index 6f9c6eace..8a7f8df48 100644 --- a/cachalot/tests/models.py +++ b/cachalot/tests/models.py @@ -1,3 +1,4 @@ +from django import VERSION as DJANGO_VERSION from django.conf import settings from django.contrib.postgres.fields import ( ArrayField, HStoreField, @@ -53,11 +54,9 @@ class PostgresModel(Model): null=True, blank=True) hstore = HStoreField(null=True, blank=True) - try: + if DJANGO_VERSION[0] < 4: from django.contrib.postgres.fields import JSONField json = JSONField(null=True, blank=True) - except ImportError: - pass int_range = IntegerRangeField(null=True, blank=True) try: diff --git a/cachalot/tests/read.py b/cachalot/tests/read.py index a46effe53..f36170032 100644 --- a/cachalot/tests/read.py +++ b/cachalot/tests/read.py @@ -557,7 +557,7 @@ def test_union(self): self.assert_query_cached(qs) with self.assertRaisesMessage( - AssertionError, + AssertionError if django_version[0] < 4 else TypeError, 'Cannot combine queries on two different base models.'): Test.objects.all() | Permission.objects.all() @@ -588,7 +588,7 @@ def test_intersection(self): self.assert_query_cached(qs) with self.assertRaisesMessage( - AssertionError, + AssertionError if django_version[0] < 4 else TypeError, 'Cannot combine queries on two different base models.'): Test.objects.all() & Permission.objects.all() diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 121d672d8..9f911cbbb 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -4,8 +4,8 @@ Quick start Requirements ............ -- Django 2.2, 3.1-3.2 -- Python 3.6-3.9 +- Django 2.2, 3.2, 4.0 +- Python 3.7-3.10 - a cache configured as ``'default'`` with one of these backends: - `django-redis `_ diff --git a/requirements.txt b/requirements.txt index 2fd01c755..9e8cdd18b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -Django>=2.2,<3.3 +Django>=2.2,<4.1 diff --git a/runtests_urls.py b/runtests_urls.py index 572098c7e..b11ff8c6f 100644 --- a/runtests_urls.py +++ b/runtests_urls.py @@ -1,5 +1,5 @@ import debug_toolbar -from django.conf.urls import url, include +from django.urls import re_path, include from django.http import HttpResponse @@ -8,6 +8,6 @@ def empty_page(request): urlpatterns = [ - url(r'^$', empty_page), - url(r'^__debug__/', include(debug_toolbar.urls)), + re_path(r'^$', empty_page), + re_path(r'^__debug__/', include(debug_toolbar.urls)), ] diff --git a/setup.py b/setup.py index 285538e41..8f1a12a4f 100755 --- a/setup.py +++ b/setup.py @@ -26,10 +26,9 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Framework :: Django :: 2.2', - 'Framework :: Django :: 3.1', 'Framework :: Django :: 3.2', + 'Framework :: Django :: 4.0', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', diff --git a/tox.ini b/tox.ini index 293e04f0d..780eb86bd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,20 @@ [tox] envlist = - py{36,37,38,39}-django2.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, - py{36,37,38,39}-django3.1-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, - py{36,37,38,39,310}-django3.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, - py{36,37,38,39,310}-djangomain-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, + py{37,38,39}-django2.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, + py{37,38,39,310}-django3.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, + py{38,39,310}-django4.0-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, + py{38,39,310}-djangomain-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, [testenv] basepython = - py36: python3.6 py37: python3.7 py38: python3.8 py39: python3.9 py310: python3.10 deps = django2.2: Django>=2.2,<2.3 - django3.1: Django>=3.1,<3.2 - django3.2: Django>=3.2,<3.3 + django3.2: Django>=3.2,<4.0 + django4.0: Django>=4.0,<4.1 djangomain: https://github.com/django/django/archive/main.tar.gz psycopg2-binary>=2.8,<2.9 mysqlclient @@ -42,7 +41,6 @@ commands = [gh-actions] python = - 3.6: py36 3.7: py37 3.8: py38 3.9: py39 @@ -51,6 +49,6 @@ python = [gh-actions:env] DJANGO = 2.2: django2.2 - 3.1: django3.1 3.2: django3.2 + 4.0: django4.0 main: djangomain