Skip to content

Commit a943e4c

Browse files
authored
💥 Reduce compatibility to Django 4.2
Remove compatibility for: - Django 2.2, 3.0, 3.1, 3.2, 4.0, 4.1 - Python 3.6, 3.7 General changes: - 💥 Reduce test coverage to Django 4.2 - ⬆️ Upgrade Ubuntu test suite runners 20.04 → 22.04 - 💥 Use Django 4.2 to build documentation - 💥 Adjust PyPI classifiers and versions - 🔧 Set pyupgrade to Python 3.8+ (remove Python 3.6, 3.7) - ✨ Add django-upgrade to Pre-Commit - 🔨 Simplify URL path in integration project Django Deprecations: - 💥 Replace force_text with force_str Deprecated in 2.0, deleted in 3.0. https://docs.djangoproject.com/en/stable/releases/2.0/#backwards-incompatible-changes-in-2-0 https://docs.djangoproject.com/en/stable/releases/3.0/#features-deprecated-in-3-0 - 💥 Remove default_app_config variable Deprecated in 3.2, removed in 4.1. https://docs.djangoproject.com/en/stable/releases/3.2/#features-deprecated-in-3-2 https://docs.djangoproject.com/en/stable/releases/4.1/#features-removed-in-4-1 - 💥 Remove USE_L10N Deprecated in 4.0, removed in 5.0. https://docs.djangoproject.com/en/stable/releases/4.0/#localization https://docs.djangoproject.com/en/stable/releases/5.0/#features-removed-in-5-0 PR #303
1 parent 2ff2ef4 commit a943e4c

File tree

12 files changed

+28
-104
lines changed

12 files changed

+28
-104
lines changed

.github/workflows/run-project-tests.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- src/**
1111
- tests/**
1212
- example_extension_project/**
13-
- example_integration_project/**
1413
- example_replacement_project/**
1514

1615
env:
@@ -22,24 +21,17 @@ jobs:
2221
runs-on: ${{ matrix.os }}
2322
strategy:
2423
matrix:
25-
os: [ubuntu-20.04, windows-2022]
26-
# Django LTS versions & latest version only
27-
django-version: ["2.2", "3.2", "4.2"]
28-
project: ["extension", "integration", "replacement"]
29-
exclude:
30-
# Django Registration 2 does not support Django above 2.2
31-
- django-version: "3.2"
32-
project: "integration"
33-
- django-version: "4.2"
34-
project: "integration"
24+
os: [ubuntu-22.04, windows-2022]
25+
django-version: ["4.2"]
26+
project: ["extension", "replacement"]
3527

3628
steps:
3729
- uses: actions/checkout@v4
3830

3931
- name: Set up Python
4032
uses: actions/setup-python@v5
4133
with:
42-
python-version: "3.9"
34+
python-version: "3.12"
4335

4436
- name: Upgrade pip
4537
run: python3 -m pip install -U distlib pip setuptools wheel

.github/workflows/run-tests.yml

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,9 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818
strategy:
1919
matrix:
20-
os: [ubuntu-20.04, windows-2022]
21-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
22-
django-version: ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2"]
23-
exclude:
24-
# Django 2.2
25-
- django-version: "2.2"
26-
python-version: "3.10"
27-
- django-version: "2.2"
28-
python-version: "3.11"
29-
- django-version: "2.2"
30-
python-version: "3.12"
31-
# Django 3.0
32-
- django-version: "3.0"
33-
python-version: "3.10"
34-
- django-version: "3.0"
35-
python-version: "3.11"
36-
- django-version: "3.0"
37-
python-version: "3.12"
38-
# Django 3.1
39-
- django-version: "3.1"
40-
python-version: "3.10"
41-
- django-version: "3.1"
42-
python-version: "3.11"
43-
- django-version: "3.1"
44-
python-version: "3.12"
45-
# Django 3.2
46-
- django-version: "3.2"
47-
python-version: "3.11"
48-
- django-version: "3.2"
49-
python-version: "3.12"
50-
# Django 4.0
51-
- django-version: "4.0"
52-
python-version: "3.6"
53-
- django-version: "4.0"
54-
python-version: "3.7"
55-
- django-version: "4.0"
56-
python-version: "3.11"
57-
- django-version: "4.0"
58-
python-version: "3.12"
59-
# Django 4.1
60-
- django-version: "4.1"
61-
python-version: "3.6"
62-
- django-version: "4.1"
63-
python-version: "3.7"
64-
- django-version: "4.1"
65-
python-version: "3.12"
66-
# Django 4.2
67-
- django-version: "4.2"
68-
python-version: "3.6"
69-
- django-version: "4.2"
70-
python-version: "3.7"
20+
os: [ubuntu-22.04, windows-2022]
21+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
22+
django-version: ["4.2"]
7123

7224
steps:
7325
- uses: actions/checkout@v4

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ repos:
5252
rev: v3.17.0
5353
hooks:
5454
- id: pyupgrade
55-
args: [--py36-plus]
55+
args: [--py38-plus]
56+
- repo: https://github.com/adamchainz/django-upgrade
57+
rev: "1.20.0"
58+
hooks:
59+
- id: django-upgrade
60+
args: [--target-version, "4.2"]
5661
- repo: https://github.com/mgedmin/check-manifest
5762
rev: "0.49"
5863
hooks:

doc-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Django>=3.2,<3.3
1+
Django>=4.2,<4.3
22
factory-boy==3.3.0
33
Faker==26.1.0
44
Pygments==2.18.0

docs/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import sphinx_rtd_theme # noqa: F401
2828
from django import setup as django_setup
2929
from django.conf import settings as django_settings
30-
from django.utils.encoding import force_text
30+
from django.utils.encoding import force_str
3131
from django.utils.html import strip_tags
3232

3333
sys.path.insert(0, abspath(join("..", "src")))
@@ -53,9 +53,9 @@ def annotate_field(lines, field, models):
5353

5454
if field.help_text:
5555
# Decode and strip any html out of the field's help text
56-
help_text = strip_tags(force_text(field.help_text))
56+
help_text = strip_tags(force_str(field.help_text))
5757
else:
58-
help_text = force_text(field.verbose_name).capitalize()
58+
help_text = force_str(field.verbose_name).capitalize()
5959
# Add the model field to the end of the docstring as a param
6060
# using the verbose name as the description
6161
lines.append(f":param {field.attname}: {help_text}")
@@ -102,9 +102,9 @@ def process_docstring(app, what, name, obj, options, lines):
102102
field = form.base_fields[field_name]
103103
if field.help_text:
104104
# Decode and strip any html out of the field's help text
105-
help_text = strip_tags(force_text(field.help_text))
105+
help_text = strip_tags(force_str(field.help_text))
106106
else:
107-
help_text = force_text(field.label).capitalize()
107+
help_text = force_str(field.label).capitalize()
108108
lines.append(f":param {field_name}: {help_text}")
109109
if field.widget.is_hidden:
110110
lines.append(

example_extension_project/config/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112

113113
USE_I18N = True
114114

115-
USE_L10N = True
116115

117116
USE_TZ = True
118117

example_integration_project/config/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@
118118

119119
USE_I18N = True
120120

121-
USE_L10N = True
122121

123122
USE_TZ = True
124123

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
"""Integration project URL Configuration"""
22

33
from django.contrib import admin
4-
from django.urls import re_path
4+
from django.urls import path, re_path
55
from django.views.generic import TemplateView
66

77
urlpatterns = [
88
re_path(r"^admin/", admin.site.urls),
9-
re_path(
10-
r"^$", TemplateView.as_view(template_name="home.html"), name="home"
11-
),
9+
path("", TemplateView.as_view(template_name="home.html"), name="home"),
1210
]

example_replacement_project/config/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114

115115
USE_I18N = True
116116

117-
USE_L10N = True
118117

119118
USE_TZ = True
120119

pyproject.toml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["flit_core >=3.2,<4"]
2+
requires = ["flit_core >=3.4,<4"]
33
build-backend = "flit_core.buildapi"
44

55
[project]
@@ -10,8 +10,8 @@ authors = [
1010
{ name = "Andrew Pinkham" },
1111
]
1212
readme = "README.rst"
13-
requires-python = ">=3.6"
14-
dependencies = ["django>=2.2"]
13+
requires-python = ">=3.8"
14+
dependencies = ["django>=4.2"]
1515
license = { file = "LICENSE"}
1616
classifiers = [
1717
"Development Status :: 5 - Production/Stable",
@@ -20,21 +20,13 @@ classifiers = [
2020
"Operating System :: OS Independent",
2121
"Topic :: Software Development :: Libraries",
2222
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.6",
24-
"Programming Language :: Python :: 3.7",
2523
"Programming Language :: Python :: 3.8",
2624
"Programming Language :: Python :: 3.9",
2725
"Programming Language :: Python :: 3.10",
2826
"Programming Language :: Python :: 3.11",
2927
"Programming Language :: Python :: 3.12",
3028
"Programming Language :: Python :: 3 :: Only",
3129
"Framework :: Django",
32-
"Framework :: Django :: 2.2",
33-
"Framework :: Django :: 3.0",
34-
"Framework :: Django :: 3.1",
35-
"Framework :: Django :: 3.2",
36-
"Framework :: Django :: 4.0",
37-
"Framework :: Django :: 4.1",
3830
"Framework :: Django :: 4.2",
3931
]
4032

@@ -87,5 +79,5 @@ exclude = [
8779

8880
[tool.black]
8981
line-length = 79
90-
target-version = ['py36', 'py37', 'py38', 'py39']
82+
target-version = ['py38']
9183
include = '\.pyi?$'

0 commit comments

Comments
 (0)