Skip to content

Commit 5f1489b

Browse files
authored
feat!: add support for Django 5.2 (#148)
Adds support for Django 5.2 BREAKING CHANGE: drop support for Python versions less than 3.9 and Django versions less than 4.2
1 parent 20d26e7 commit 5f1489b

File tree

8 files changed

+150
-116
lines changed

8 files changed

+150
-116
lines changed

.github/workflows/run-tests.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,32 @@ jobs:
1111
test:
1212
name: Test
1313

14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-24.04
1515
strategy:
1616
matrix:
1717
include:
18-
# Django 3.2
19-
- django-version: '>= 3.2, < 3.3'
20-
python-version: "3.7"
21-
- django-version: '>= 3.2, < 3.3'
22-
python-version: "3.8"
23-
- django-version: '>= 3.2, < 3.3'
24-
python-version: "3.9"
25-
- django-version: '>= 3.2, < 3.3'
18+
# Django 4.0 - 4.1
19+
- django-version: '>= 4.0, <= 4.2'
2620
python-version: "3.10"
2721

28-
# Django 4.0 - 4.1
29-
- django-version: '>= 4.0, < 4.2'
30-
python-version: "3.8"
31-
- django-version: '>= 4.0, < 4.2'
32-
python-version: "3.9"
33-
- django-version: '>= 4.0, < 4.2'
22+
# Django 5.0 - 5.2
23+
- django-version: '>= 5.0, <= 5.2'
3424
python-version: "3.10"
25+
- django-version: '>= 5.0, <= 5.2'
26+
python-version: "3.11"
27+
- django-version: '>= 5.0, <= 5.2'
28+
python-version: "3.12"
3529

3630
steps:
37-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v5
3832

3933
- name: Set up Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@v5
34+
uses: actions/setup-python@v6
4135
with:
4236
python-version: ${{ matrix.python-version }}
4337

4438
- name: Install poetry
45-
uses: abatilo/actions-poetry@v3
39+
uses: abatilo/actions-poetry@v4
4640

4741
- name: Install dependencies
4842
run: |
@@ -55,6 +49,6 @@ jobs:
5549
poetry run pytest --cov=rest_email_auth --cov-report=xml
5650
5751
- name: Upload coverage report
58-
uses: codecov/codecov-action@v4
52+
uses: codecov/codecov-action@v5
5953
with:
6054
token: ${{ secrets.CODECOV_TOKEN }}

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ Features:
3838
Compatibility
3939
*************
4040

41-
| **Python:** 3.6 or later
42-
| **Django:** Versions 3.2 through 4.1
43-
| **Django REST Framework:** 3.14 or later
41+
| **Python:** 3.9 or later
42+
| **Django:** Versions 4.2 through 5.2
43+
| **Django REST Framework:** 3.16 or later
4444
4545
***************
4646
Adding Features

example_project/example_project/urls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
from django.contrib import admin
1919

2020
from rest_framework.documentation import include_docs_urls
21-
21+
from rest_framework.renderers import DocumentationRenderer
22+
from rest_framework.schemas import openapi
2223

2324
urlpatterns = [
2425
path(r"account/", include("rest_email_auth.urls")),
2526
path(r"admin/", admin.site.urls),
26-
path(r"docs/", include_docs_urls(title="Example Project")),
27+
path(r"docs/", include_docs_urls(title="Example Project", renderer_classes=[DocumentationRenderer], generator_class=openapi.SchemaGenerator)),
2728
]

poetry.lock

Lines changed: 104 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ readme = "README.rst"
2525
packages = [{include = "rest_email_auth"}]
2626

2727
[tool.poetry.dependencies]
28-
python = "^3.7"
29-
Django = ">=3.2, <5"
28+
python = "^3.9"
29+
Django = ">=4.2, <6"
3030
django-email-utils = "^1"
31-
djangorestframework = "^3.10"
31+
djangorestframework = "^3.16"
3232

3333
[tool.poetry.group.ci]
3434
optional = true
@@ -38,7 +38,7 @@ optional = true
3838
coreapi = "~=2.3"
3939

4040
[tool.poetry.group.dev.dependencies]
41-
factory_boy = "~=3.2"
41+
factory_boy = "~=3.3"
4242
pytest = "~=7.4"
4343
pytest-django = "~=4.5"
4444
pytest-cov = "~=4.1"

rest_email_auth/tests/serializers/test_email_serializer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def test_serialize(email_factory):
9595

9696
expected = {
9797
"id": email.id,
98-
"created_at": email.created_at.isoformat(),
98+
# DRF truncates last bytes and adds a Z for UTC timestamps
99+
"created_at": email.created_at.isoformat()[:-6] + 'Z',
99100
"email": email.email,
100101
"is_primary": email.is_primary,
101102
"is_verified": email.is_verified,

setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,27 @@ def get_description():
2121
"Development Status :: 5 - Production/Stable",
2222
# Supported versions of Django
2323
"Framework :: Django",
24-
"Framework :: Django :: 3.2",
25-
"Framework :: Django :: 4.0",
26-
"Framework :: Django :: 4.1",
24+
"Framework :: Django :: 4.2",
25+
"Framework :: Django :: 5.2",
2726
"Intended Audience :: Developers",
2827
"License :: OSI Approved :: MIT License",
2928
"Natural Language :: English",
3029
# Supported versions of Python
3130
"Programming Language :: Python",
3231
"Programming Language :: Python :: 3",
33-
"Programming Language :: Python :: 3.6",
34-
"Programming Language :: Python :: 3.7",
32+
"Programming Language :: Python :: 3.9",
33+
"Programming Language :: Python :: 3.10",
34+
"Programming Language :: Python :: 3.11",
35+
"Programming Language :: Python :: 3.12",
3536
],
3637
# Include the actual source code
3738
include_package_data=True,
3839
packages=find_packages(),
3940
# Dependencies
4041
install_requires=[
41-
"Django >= 3.2, <= 4.2",
42+
"Django >= 4.2, <= 5.2",
4243
"django-email-utils >= 1.0, < 2.0",
4344
# DRF 3.10 is the first to support our minimum Django version of 2.2.
44-
"djangorestframework >= 3.14",
45+
"djangorestframework >= 3.16",
4546
],
4647
)

test_settings.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@
2222

2323
ROOT_URLCONF = "test_urls"
2424

25+
# Internationalization
26+
# https://docs.djangoproject.com/en/1.11/topics/i18n/
27+
28+
LANGUAGE_CODE = "en-us"
29+
30+
TIME_ZONE = "UTC"
31+
32+
USE_I18N = True
33+
34+
USE_L10N = True
35+
36+
USE_TZ = True
37+
2538

2639
# Basic settings required for the app
2740
REST_EMAIL_AUTH = {

0 commit comments

Comments
 (0)