Skip to content

Commit

Permalink
Updated minimum supported Python and Django versions (#216)
Browse files Browse the repository at this point in the history
Python 3.8+
Django 4.2+
  • Loading branch information
clintonb authored Aug 11, 2024
1 parent 2b23770 commit 828248d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 33 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
django-version: ['3.2', '4.2', 'main']
python-version: ['3.10', '3.11', '3.12']
django-version: ['4.2', '5.0', '5.1', 'main']
include:
- python-version: '3.7'
django-version: '3.2'
exclude:
- python-version: '3.8'
django-version: 'main'
django-version: '4.2'
- python-version: '3.9'
django-version: 'main'
django-version: '4.2'

services:
postgres:
image: postgres:13
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -36,12 +33,13 @@ jobs:
--health-retries 5
mariadb:
image: mariadb:10
image: mariadb:11.4
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: mysql
MARIADB_USER: root
MARIADB_ROOT_PASSWORD: mysql
MARIADB_DATABASE: mysql
options: >-
--health-cmd "mysqladmin ping"
--health-cmd "healthcheck.sh --connect --innodb_initialized"
--health-interval 10s
--health-timeout 5s
--health-retries 5
Expand Down
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage==7.2.2
isort==5.12.0
pycodestyle==2.10.0
pylint-django==2.5.3
coverage==7.6.1
isort==5.13.2
pycodestyle==2.12.1
pylint-django==2.5.5
setuptools
6 changes: 0 additions & 6 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
def runtests(*args):
warnings.filterwarnings("ignore", module="distutils")

# Ignore a python 3.6 DeprecationWarning in ModelBase.__new__ that isn't
# fixed in Django 1.x
if sys.version_info > (3, 6) and django.VERSION < (2,):
warnings.filterwarnings(
"ignore", "__class__ not set defining", DeprecationWarning)

test_apps = list(args or DEFAULT_TEST_APPS)
print([sys.argv[0], 'test', '--verbosity=1'] + test_apps)
execute_from_command_line([sys.argv[0], 'test', '--verbosity=1'] + test_apps)
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def read(filename):
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django :: 5.1',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
Expand All @@ -56,5 +57,7 @@ def read(filename):
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
)
5 changes: 5 additions & 0 deletions sortedm2m/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def get_queryset(self):
queryset = super().get_queryset()
return self._apply_rel_ordering(queryset)

def get_prefetch_querysets(self, instances, queryset=None):
# Apply the same ordering for prefetch ones
result = super().get_prefetch_querysets(instances, queryset)
return (self._apply_rel_ordering(result[0]),) + result[1:]

def get_prefetch_queryset(self, instances, queryset=None):
# Apply the same ordering for prefetch ones
result = super().get_prefetch_queryset(instances, queryset)
Expand Down
2 changes: 1 addition & 1 deletion sortedm2m_tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def set_up_test_model(
# Make the "current" state.
model_options = {
"swappable": "TEST_SWAP_MODEL",
"index_together": [["weight", "pink"]] if index_together else [],
"indexes": models.Index(fields=["weight", "pink"]) if index_together else [],
"unique_together": [["pink", "weight"]] if unique_together else [],
}
if options:
Expand Down
20 changes: 12 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
[tox]
envlist =
{py37,py38,py39,py310}-django32-{sqlite3,mysql,postgresql}
{py38,py39,py310}-django{42,main}-{sqlite3,mysql,postgresql}
{py38,py39,py310,py311,py312}-django42-{sqlite3,mysql,postgresql}
{py310,py311,py312}-django{50,51,main}-{sqlite3,mysql,postgresql}
quality
dist-validation
qunit

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
DJANGO =
3.2: django32
4.2: django42
5.0: django50
5.1: django51
main: djangomain

[testenv]
deps =
coverage
mysql: mysqlclient
postgresql: psycopg2-binary
django32: Django>=3.2,<3.3
django42: Django>=4.2,<4.3
django50: Django>=5.0,<5.1
django51: Django>=5.1,<5.2
djangomain: https://github.com/django/django/archive/main.tar.gz
ignore_outcome =
main: True
Expand All @@ -49,7 +52,7 @@ commands =

[testenv:quality]
deps =
Django>=3.2,<4.0
Django>=5.1,<5.2
selenium<4.0
psycopg2-binary
-rrequirements.txt
Expand All @@ -60,13 +63,14 @@ commands =

[testenv:dist-validation]
deps =
setuptools
twine>=3.1.1
commands =
python setup.py sdist
twine check dist/*

[testenv:qunit]
deps = selenium<4.0
deps = selenium<5.0
allowlist_externals =
timeout
commands = timeout 20 xvfb-run python test_project/qunit-runner.py
commands = timeout 20 python test_project/qunit-runner.py

0 comments on commit 828248d

Please sign in to comment.