From 3f05623a2fddc855ae50e05162e55b771d20eb66 Mon Sep 17 00:00:00 2001 From: medmunds Date: Mon, 29 Aug 2022 13:10:14 -0700 Subject: [PATCH] Drop support for Django 2.x and Python 3.5 --- CHANGELOG.rst | 14 +- setup.py | 6 +- tests/test_settings/settings_2_1.py | 121 ------------------ tests/test_settings/settings_2_2.py | 121 ------------------ .../{settings_2_0.py => settings_4_2.py} | 33 ++--- tests/utils.py | 5 +- tox.ini | 17 +-- 7 files changed, 37 insertions(+), 280 deletions(-) delete mode 100644 tests/test_settings/settings_2_1.py delete mode 100644 tests/test_settings/settings_2_2.py rename tests/test_settings/{settings_2_0.py => settings_4_2.py} (73%) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 816ef32..3c7ed4a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -28,7 +28,14 @@ Release history vNext ----- -*Unreleased changes* +*Unreleased v9.0 changes* + +Breaking changes +~~~~~~~~~~~~~~~~ + +* Require **Django 3.0 or later** and Python 3.6 or later. (For compatibility + with Django 2.x or Python 3.5, stay on the Anymail `v8.6 LTS`_ extended support + branch by setting your requirements to `django-anymail~=8.6`.) Features ~~~~~~~~ @@ -46,6 +53,11 @@ Fixes unsubscribe, subscribe, or bounce tracking events, rather than "unknown". (Thanks to `@puru02`_ for the fix.) +Other +~~~~~ + +* Test on Python 3.11 with Django development (Django 4.2) branch. + v8.6 LTS -------- diff --git a/setup.py b/setup.py index 7c1f055..ea73e58 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ setup( license="BSD License", packages=["anymail"], zip_safe=False, - python_requires='>=3.5', + python_requires='>=3.6', install_requires=["django>=2.0", "requests>=2.4.3"], extras_require={ # This can be used if particular backends have unique dependencies. @@ -84,7 +84,6 @@ setup( "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", @@ -95,9 +94,6 @@ setup( "Topic :: Software Development :: Libraries :: Python Modules", "Intended Audience :: Developers", "Framework :: Django", - "Framework :: Django :: 2.0", - "Framework :: Django :: 2.1", - "Framework :: Django :: 2.2", "Framework :: Django :: 3.0", "Framework :: Django :: 3.1", "Framework :: Django :: 3.2", diff --git a/tests/test_settings/settings_2_1.py b/tests/test_settings/settings_2_1.py deleted file mode 100644 index 08df5e8..0000000 --- a/tests/test_settings/settings_2_1.py +++ /dev/null @@ -1,121 +0,0 @@ -""" -Django settings for Anymail tests. - -Generated by 'django-admin startproject' using Django 2.1a1. - -For more information on this file, see -https://docs.djangoproject.com/en/dev/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/dev/ref/settings/ -""" - -import os - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'NOT_FOR_PRODUCTION_USE' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - - -# Application definition - -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'anymail', -] - -MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -] - -ROOT_URLCONF = 'tests.test_settings.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, - }, -] - -WSGI_APPLICATION = 'tests.wsgi.application' - - -# Database -# https://docs.djangoproject.com/en/dev/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} - - -# Password validation -# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - - -# Internationalization -# https://docs.djangoproject.com/en/dev/topics/i18n/ - -LANGUAGE_CODE = 'en-us' - -TIME_ZONE = 'UTC' - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/dev/howto/static-files/ - -STATIC_URL = '/static/' diff --git a/tests/test_settings/settings_2_2.py b/tests/test_settings/settings_2_2.py deleted file mode 100644 index beed3ac..0000000 --- a/tests/test_settings/settings_2_2.py +++ /dev/null @@ -1,121 +0,0 @@ -""" -Django settings for Anymail tests. - -Generated by 'django-admin startproject' using Django 2.2a1. - -For more information on this file, see -https://docs.djangoproject.com/en/dev/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/dev/ref/settings/ -""" - -import os - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'NOT_FOR_PRODUCTION_USE' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - - -# Application definition - -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'anymail', -] - -MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -] - -ROOT_URLCONF = 'tests.test_settings.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, - }, -] - -WSGI_APPLICATION = 'tests.wsgi.application' - - -# Database -# https://docs.djangoproject.com/en/dev/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} - - -# Password validation -# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - - -# Internationalization -# https://docs.djangoproject.com/en/dev/topics/i18n/ - -LANGUAGE_CODE = 'en-us' - -TIME_ZONE = 'UTC' - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/dev/howto/static-files/ - -STATIC_URL = '/static/' diff --git a/tests/test_settings/settings_2_0.py b/tests/test_settings/settings_4_2.py similarity index 73% rename from tests/test_settings/settings_2_0.py rename to tests/test_settings/settings_4_2.py index b9bad06..0888c34 100644 --- a/tests/test_settings/settings_2_0.py +++ b/tests/test_settings/settings_4_2.py @@ -1,23 +1,23 @@ """ Django settings for Anymail tests. -Generated by 'django-admin startproject' using Django 2.0.3. +Generated by 'django-admin startproject' using Django 4.0.1. For more information on this file, see -https://docs.djangoproject.com/en/2.0/topics/settings/ +https://docs.djangoproject.com/en/4.0/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/2.0/ref/settings/ +https://docs.djangoproject.com/en/4.0/ref/settings/ """ -import os +from pathlib import Path -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'NOT_FOR_PRODUCTION_USE' @@ -72,18 +72,18 @@ WSGI_APPLICATION = 'tests.wsgi.application' # Database -# https://docs.djangoproject.com/en/2.0/ref/settings/#databases +# https://docs.djangoproject.com/en/4.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation -# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -102,7 +102,7 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization -# https://docs.djangoproject.com/en/2.0/topics/i18n/ +# https://docs.djangoproject.com/en/4.0/topics/i18n/ LANGUAGE_CODE = 'en-us' @@ -110,12 +110,15 @@ TIME_ZONE = 'UTC' USE_I18N = True -USE_L10N = True - USE_TZ = True # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/2.0/howto/static-files/ +# https://docs.djangoproject.com/en/4.0/howto/static-files/ -STATIC_URL = '/static/' +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/tests/utils.py b/tests/utils.py index d2da4cb..da9d1d2 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -36,10 +36,7 @@ SAMPLE_EMAIL_FILENAME = "sample_email.txt" def test_file_path(filename): """Returns path to a test file""" - # Must convert to a plain str while we support Python 3.5, - # because django.core.mail uses os.path functions that don't - # accept pathlib.Path until Python 3.6. - return str(TEST_FILES_DIR.joinpath(filename)) + return TEST_FILES_DIR.joinpath(filename) def test_file_content(filename): diff --git a/tox.ini b/tox.ini index 6e53e72..c800dad 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ envlist = # Test lint, docs, earliest/latest Django first, to catch most errors early... lint django41-py310-all - django20-py35-all + django30-py36-all docs # ... then test all the other supported combinations: # Django 4.1: Python 3.8, 3.9, 3.10 @@ -18,25 +18,16 @@ envlist = # Django 3.1: Python 3.6, 3.7, 3.8, 3.9 (added in 3.1.3) django31-py{36,37,38,39,py38}-all # Django 3.0: Python 3.6, 3.7, 3.8, 3.9 (added in 3.0.11) - django30-py{36,37,38,39,py38}-all - # Django 2.2: Python 3.5, 3.6, 3.7, 3.8 (added in 2.2.8), 3.9 (added in 2.2.17) - django22-py{35,36,37,38,39,py38}-all - # Django 2.1: Python 3.5, 3.6, or 3.7 - django21-py{35,36,37,py37}-all - # Django 2.0: Python 3.5+ - django20-py{36,py36}-all + django30-py{37,38,39,py38}-all # ... then prereleases (if available) and current development: - djangoDev-py{38,39,310,py38}-all + djangoDev-py{38,39,310,311,py38}-all # ... then partial installation (limit extras): django40-py310-{none,amazon_ses,postal} # ... then older versions of some dependencies: - django22-py37-all-old_urllib3 + django32-py37-all-old_urllib3 [testenv] deps = - django20: django~=2.0.0 - django21: django~=2.1.0 - django22: django~=2.2.0 django30: django~=3.0.0 django31: django~=3.1.0 django32: django~=3.2.0