Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Django 3.2 support #736

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
django-version: ['3.2', '4.2', '5.0', '5.1', 'main']
django-version: ['4.2', '5.0', '5.1', 'main']
postgres-version: ['12', '16']
mariadb-version: ['10.6', '10.11', '11.2']
exclude:
# Django <=4.0 doesn't support python 3.11 (https://docs.djangoproject.com/en/4.1/faq/install/)
- python-version: '3.11'
django-version: '3.2'
- python-version: '3.12'
django-version: '3.2'

# Django 5.0 doesn't support python <=3.9 (https://docs.djangoproject.com/en/5.0/faq/install/)
- python-version: '3.8'
django-version: '5.0'
Expand All @@ -44,12 +38,6 @@ jobs:
- python-version: '3.9'
django-version: 'main'

# only test Django dev with PostgreSQL 12 and MariaDB 10.4
- django-version: '3.2'
postgres-version: '12'
- django-version: '3.2'
mariadb-version: '10.4'

services:
postgres:
image: postgres:${{ matrix.postgres-version }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
rev: '1.20.0'
hooks:
- id: django-upgrade
args: [--target-version, '3.2']
args: [--target-version, '4.2']
- repo: https://github.com/hhatto/autopep8
rev: 'v2.3.1'
hooks:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Silk is a live profiling and inspection tool for the Django framework. Silk inte

Silk has been tested with:

* Django: 3.2, 4.2, 5.0, 5.1
* Django: 4.2, 5.0, 5.1
* Python: 3.8, 3.9, 3.10, 3.11, 3.12

## Installation
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ Features
Requirements
------------

* Django: 3.2, 4.2, 5.0, 5.1
* Django: 4.2, 5.0, 5.1
* Python: 3.8, 3.9, 3.10
1 change: 0 additions & 1 deletion project/project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

ROOT_URLCONF = 'project.urls'

# Django 3.2+
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

MIDDLEWARE = [
Expand Down
13 changes: 0 additions & 13 deletions project/tests/test_view_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,6 @@ def test_order_by(self):


class TestContext(TestCase):
def assertQuerySetEqual(self, *args, **kwargs):
"""
A shim for QuerySetEqual to enable support for multiple versions of Django
TODO: delete this after support for Django 3.2 is dropped
Reference: https://docs.djangoproject.com/en/5.0/topics/testing/tools/#django.test.TransactionTestCase.assertQuerySetEqual
"""
if hasattr(super(), 'assertQuerySetEqual'):
# Django > 3.2
super().assertQuerySetEqual(*args, **kwargs)
else:
# Django < 5.1
super().assertQuerysetEqual(*args, **kwargs)

def test_default(self):
request = Mock(spec_set=['GET', 'session'])
request.session = {}
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django :: 5.1',
Expand All @@ -37,7 +36,7 @@
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
install_requires=[
'Django>=3.2',
'Django>=4.2',
'sqlparse',
'autopep8',
'gprof2dot>=2017.09.19',
Expand Down
20 changes: 7 additions & 13 deletions silk/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import sqlparse
from django.conf import settings
from django.core.files.storage import storages
from django.core.files.storage.handler import InvalidStorageError
from django.db import models, transaction
from django.db.models import (
BooleanField,
Expand All @@ -27,19 +29,11 @@
from silk.utils.profile_parser import parse_profile

try:
# New in Django 4.2
from django.core.files.storage import storages
from django.core.files.storage.handler import InvalidStorageError
try:
silk_storage = storages['SILKY_STORAGE']
except InvalidStorageError:
from django.utils.module_loading import import_string
storage_class = SilkyConfig().SILKY_STORAGE_CLASS or settings.DEFAULT_FILE_STORAGE
silk_storage = import_string(storage_class)()
except ImportError:
# Deprecated since Django 4.2, Removed in Django 5.1
from django.core.files.storage import get_storage_class
silk_storage = get_storage_class(SilkyConfig().SILKY_STORAGE_CLASS)()
silk_storage = storages['SILKY_STORAGE']
except InvalidStorageError:
from django.utils.module_loading import import_string
storage_class = SilkyConfig().SILKY_STORAGE_CLASS or settings.DEFAULT_FILE_STORAGE
silk_storage = import_string(storage_class)()


# Seperated out so can use in tests w/o models
Expand Down
3 changes: 0 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ python =

[gh-actions:env]
DJANGO =
3.2: dj32
4.2: dj42
5.0: dj50
5.1: dj51
main: djmain

[tox]
envlist =
py{38,39,310}-dj32-{sqlite3,mysql,postgresql}
py{38,39,310,311,312}-dj42-{sqlite3,mysql,postgresql}
py{310,311,312}-dj{50,51,main}-{sqlite3,mysql,postgresql}

Expand All @@ -29,7 +27,6 @@ deps =
-rrequirements.txt
mysql: mysqlclient
postgresql: psycopg2-binary
dj32: django>=3.2,<3.3
dj42: django>=4.2,<4.3
dj50: django>=5.0,<5.1
dj51: django>=5.1,<5.2
Expand Down
Loading