Skip to content

Commit 527c746

Browse files
authored
Drop support for python 3.8, add support for python 3.12 and django 5.1 (#973)
1 parent 8c3a58c commit 527c746

File tree

10 files changed

+43
-44
lines changed

10 files changed

+43
-44
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,26 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
19-
django-version: [4.2, 5.0, 5.1b1, master]
18+
python-version: [3.9, "3.10", 3.11, 3.12] # 3.13 can be supported if lxml supports 3.13
19+
django-version: [4.2, 5.0, 5.1, master]
2020
exclude:
2121
# Django 4.2
2222
- python-version: 3.12
2323
django-version: 4.2
24+
- python-version: 3.13
25+
django-version: 4.2
2426

2527
# Django 5.0
26-
- python-version: 3.8
27-
django-version: 5.0
2828
- python-version: 3.9
2929
django-version: 5.0
30+
- python-version: 3.13
31+
django-version: 5.0
3032

3133
# Django 5.1
32-
- python-version: 3.8
33-
django-version: 5.1b1
3434
- python-version: 3.9
35-
django-version: 5.1b1
36-
35+
django-version: 5.1
36+
3737
# master
38-
- python-version: 3.8
39-
django-version: master
4038
- python-version: 3.9
4139
django-version: master
4240

.pre-commit-config.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 23.1.0
3+
rev: 24.10.0
44
hooks:
55
- id: black
66
language_version: python3.11
77

88
- repo: https://github.com/asottile/pyupgrade
9-
rev: v3.3.1
9+
rev: v3.19.0
1010
hooks:
1111
- id: pyupgrade
1212
args: [--py38-plus]
1313

1414
- repo: https://github.com/pycqa/isort
15-
rev: 5.12.0
15+
rev: 5.13.2
1616
hooks:
1717
- id: isort
1818

1919
- repo: https://github.com/PyCQA/flake8
20-
rev: 6.0.0
20+
rev: 7.1.1
2121
hooks:
2222
- id: flake8
2323

24+
- repo: https://github.com/adamchainz/django-upgrade
25+
rev: "1.22.1"
26+
hooks:
27+
- id: django-upgrade
28+
args: [--target-version, "4.2"]
29+
- repo: https://github.com/asottile/pyupgrade
30+
rev: v3.19.0
31+
hooks:
32+
- id: pyupgrade
33+
args: [--py39-plus]
34+

django_tables2/columns/jsoncolumn.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import json
22

3+
from django.db.models import JSONField
34
from django.utils.html import format_html
45

56
from ..utils import AttributeDict
67
from .base import library
78
from .linkcolumn import BaseLinkColumn
89

910
try:
10-
try:
11-
from django.contrib.postgres.fields import HStoreField
12-
from django.db.models import JSONField # django==3.1 moved JSONField
13-
except ImportError:
14-
from django.contrib.postgres.fields import HStoreField, JSONField
11+
from django.contrib.postgres.fields import HStoreField
1512

1613
POSTGRES_AVAILABLE = True
1714
except ImportError:

django_tables2/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from itertools import count
2-
from typing import Any, Dict, Optional
2+
from typing import Any, Optional
33

44
from django.core.exceptions import ImproperlyConfigured
55
from django.views.generic.list import ListView
@@ -152,7 +152,7 @@ def get_table_kwargs(self):
152152
"""
153153
return {}
154154

155-
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
155+
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
156156
"""
157157
Overridden version of `.TemplateResponseMixin` to inject the table into
158158
the template's context.
@@ -227,7 +227,7 @@ def get_tables_data(self):
227227
"""
228228
return self.tables_data
229229

230-
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
230+
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
231231
context = super().get_context_data(**kwargs)
232232
tables = self.get_tables()
233233

example/app/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from .models import Continent, Country
44

55

6+
@admin.register(Country)
67
class CountryAdmin(admin.ModelAdmin):
78
list_per_page = 20
89

910
list_display = ("name", "continent")
1011

1112

12-
admin.site.register(Country, CountryAdmin)
1313
admin.site.register(Continent)

example/settings.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@
5858
("zh-hans", _("Chinese (Simplified)")),
5959
]
6060

61-
# If you set this to False, Django will not format dates, numbers and
62-
# calendars according to the current locale
63-
USE_L10N = True
64-
6561
# Absolute filesystem path to the directory that will hold user-uploaded files.
6662
# Example: "/home/media/media.lawrence.com/media/"
6763
MEDIA_ROOT = join(ROOT, "media")

requirements/common.pip

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# xml parsing
2-
lxml==4.9.3
3-
pytz==2023.3.post1
4-
tablib[xls,yaml]==3.5.0
5-
openpyxl==3.1.2
6-
psycopg2-binary==2.9.5
7-
django-filter==23.3
2+
lxml==5.3.0
3+
pytz==2024.2
4+
tablib[xls,yaml]==3.7.0
5+
openpyxl==3.1.5
6+
psycopg2-binary==2.9.10
7+
django-filter==24.3

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
"Framework :: Django",
2828
"Framework :: Django :: 4.2",
2929
"Framework :: Django :: 5.0",
30+
"Framework :: Django :: 5.1",
3031
"Intended Audience :: Developers",
3132
"License :: OSI Approved :: BSD License",
3233
"Operating System :: OS Independent",
3334
"Programming Language :: Python",
3435
"Programming Language :: Python :: 3",
3536
"Programming Language :: Python :: 3 :: Only",
36-
"Programming Language :: Python :: 3.8",
3737
"Programming Language :: Python :: 3.9",
3838
"Programming Language :: Python :: 3.10",
3939
"Programming Language :: Python :: 3.11",

tests/columns/test_jsoncolumn.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
from django.contrib.postgres.fields import HStoreField
22
from django.db import models
3+
from django.db.models import JSONField
34
from django.test import SimpleTestCase
45

56
import django_tables2 as tables
67

7-
try:
8-
from django.db.models import JSONField # django==3.1 moved json field
9-
except ImportError:
10-
from django.contrib.postgres.fields import JSONField
11-
128

139
class JsonColumnTestCase(SimpleTestCase):
1410
def test_should_be_used_for_json_and_hstore_fields(self):

tox.ini

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
[tox]
22
args_are_paths = false
33
envlist =
4-
py38-{4.2},
54
py39-{4.2},
6-
py310{4.2,5.0,master},
7-
py311{4.2,5.0,master},
8-
py312{5.0,master},
5+
py310{4.2,5.0,5.1,master},
6+
py311{4.2,5.0,5.1,master},
7+
py312{5.0,5.1,master},
8+
; py313{master},
99
docs,
1010
flake8,
1111
isort,
1212

1313
[testenv]
1414
basepython =
15-
py38: python3.8
1615
py39: python3.9
1716
py310: python3.10
1817
py311: python3.11
1918
py312: python3.12
19+
py313: python3.13
2020
usedevelop = true
2121
pip_pre = true
2222
setenv =
@@ -27,6 +27,7 @@ commands =
2727
deps =
2828
4.2: Django==4.2.*
2929
5.0: Django==5.0.*
30+
5.1: Django==5.1.*
3031
master: https://github.com/django/django/archive/master.tar.gz
3132
coverage
3233
-r{toxinidir}/requirements/common.pip

0 commit comments

Comments
 (0)