Drop support for Django 2.x and Python 3.5

This commit is contained in:
medmunds
2022-08-29 13:10:14 -07:00
committed by Mike Edmunds
parent a4f50c4340
commit 3f05623a2f
7 changed files with 37 additions and 280 deletions

View File

@@ -28,7 +28,14 @@ Release history
vNext 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 Features
~~~~~~~~ ~~~~~~~~
@@ -46,6 +53,11 @@ Fixes
unsubscribe, subscribe, or bounce tracking events, rather than "unknown". unsubscribe, subscribe, or bounce tracking events, rather than "unknown".
(Thanks to `@puru02`_ for the fix.) (Thanks to `@puru02`_ for the fix.)
Other
~~~~~
* Test on Python 3.11 with Django development (Django 4.2) branch.
v8.6 LTS v8.6 LTS
-------- --------

View File

@@ -57,7 +57,7 @@ setup(
license="BSD License", license="BSD License",
packages=["anymail"], packages=["anymail"],
zip_safe=False, zip_safe=False,
python_requires='>=3.5', python_requires='>=3.6',
install_requires=["django>=2.0", "requests>=2.4.3"], install_requires=["django>=2.0", "requests>=2.4.3"],
extras_require={ extras_require={
# This can be used if particular backends have unique dependencies. # This can be used if particular backends have unique dependencies.
@@ -84,7 +84,6 @@ setup(
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
@@ -95,9 +94,6 @@ setup(
"Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"Framework :: Django", "Framework :: Django",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0", "Framework :: Django :: 3.0",
"Framework :: Django :: 3.1", "Framework :: Django :: 3.1",
"Framework :: Django :: 3.2", "Framework :: Django :: 3.2",

View File

@@ -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/'

View File

@@ -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/'

View File

@@ -1,23 +1,23 @@
""" """
Django settings for Anymail tests. 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 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 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, ...) # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production # 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! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'NOT_FOR_PRODUCTION_USE' SECRET_KEY = 'NOT_FOR_PRODUCTION_USE'
@@ -72,18 +72,18 @@ WSGI_APPLICATION = 'tests.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases # https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 'NAME': BASE_DIR / 'db.sqlite3',
} }
} }
# Password validation # 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 = [ AUTH_PASSWORD_VALIDATORS = [
{ {
@@ -102,7 +102,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/ # https://docs.djangoproject.com/en/4.0/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
@@ -110,12 +110,15 @@ TIME_ZONE = 'UTC'
USE_I18N = True USE_I18N = True
USE_L10N = True
USE_TZ = True USE_TZ = True
# Static files (CSS, JavaScript, Images) # 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'

View File

@@ -36,10 +36,7 @@ SAMPLE_EMAIL_FILENAME = "sample_email.txt"
def test_file_path(filename): def test_file_path(filename):
"""Returns path to a test file""" """Returns path to a test file"""
# Must convert to a plain str while we support Python 3.5, return TEST_FILES_DIR.joinpath(filename)
# 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))
def test_file_content(filename): def test_file_content(filename):

17
tox.ini
View File

@@ -6,7 +6,7 @@ envlist =
# Test lint, docs, earliest/latest Django first, to catch most errors early... # Test lint, docs, earliest/latest Django first, to catch most errors early...
lint lint
django41-py310-all django41-py310-all
django20-py35-all django30-py36-all
docs docs
# ... then test all the other supported combinations: # ... then test all the other supported combinations:
# Django 4.1: Python 3.8, 3.9, 3.10 # 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) # 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 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) # 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 django30-py{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
# ... then prereleases (if available) and current development: # ... 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): # ... then partial installation (limit extras):
django40-py310-{none,amazon_ses,postal} django40-py310-{none,amazon_ses,postal}
# ... then older versions of some dependencies: # ... then older versions of some dependencies:
django22-py37-all-old_urllib3 django32-py37-all-old_urllib3
[testenv] [testenv]
deps = deps =
django20: django~=2.0.0
django21: django~=2.1.0
django22: django~=2.2.0
django30: django~=3.0.0 django30: django~=3.0.0
django31: django~=3.1.0 django31: django~=3.1.0
django32: django~=3.2.0 django32: django~=3.2.0