From 6730a6b651c1977a34fb79a03d27a306a6570629 Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Mon, 20 Jan 2025 10:29:48 +0000 Subject: [PATCH 1/6] Add Python 3.13 and Django 5.1 to test matrix, drop unsupported versions --- .github/workflows/ci.yml | 20 ++++++-------------- README.md | 4 ++-- django_dbq/tests.py | 15 ++++----------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c2a216..0747581 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,21 +9,13 @@ jobs: strategy: matrix: - python: ["3.8", "3.9", "3.10", "3.11", "3.12"] - django: ["3.2", "4.0", "4.1", "4.2", "5.0"] + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] + django: ["4.2", "5.0", "5.1"] exclude: - - python: "3.11" - django: "3.2" - - python: "3.12" - django: "3.2" - - python: "3.11" - django: "4.0" - - python: "3.12" - django: "4.0" - - python: "3.8" - django: "5.0" - python: "3.9" django: "5.0" + - python: "3.9" + django: "5.1" database_url: - postgres://runner:password@localhost/project - mysql://root:root@127.0.0.1/project @@ -45,11 +37,11 @@ jobs: steps: - name: Start MySQL run: sudo systemctl start mysql.service - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install system Python build deps for psycopg2 run: sudo apt-get install python3-dev python3.11-dev - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Upgraded pip diff --git a/README.md b/README.md index c4e698a..d589707 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Simple database-backed job queue. Jobs are defined in your settings, and are pro Asynchronous tasks are run via a *job queue*. This system is designed to support multi-step job workflows. Supported and tested against: -- Django 3.2, 4.0, 4.1, 4.2, 5.0 -- Python 3.8, 3.9, 3.10, 3.11, 3.12 +- Django 4.2, 5.0, 5.1 +- Python 3.9, 3.10, 3.11, 3.12, 3.13 ## Getting Started diff --git a/django_dbq/tests.py b/django_dbq/tests.py index dd83540..ba80b7f 100644 --- a/django_dbq/tests.py +++ b/django_dbq/tests.py @@ -1,8 +1,8 @@ -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone as datetime_timezone import mock import freezegun -from django.core.management import call_command, CommandError +from django.core.management import call_command from django.test import TestCase from django.test.utils import override_settings from django.utils import timezone @@ -13,14 +13,6 @@ from io import StringIO -try: - utc = timezone.utc -except AttributeError: - from datetime import timezone as datetime_timezone - - utc = datetime_timezone.utc - - def test_task(job=None): pass # pragma: no cover @@ -253,7 +245,8 @@ def test_gets_jobs_in_priority_and_date_order(self): def test_ignores_jobs_until_run_after_is_in_the_past(self): job_1 = Job.objects.create(name="testjob") job_2 = Job.objects.create( - name="testjob", run_after=datetime(2021, 11, 4, 8, tzinfo=utc) + name="testjob", + run_after=datetime(2021, 11, 4, 8, tzinfo=datetime_timezone.utc), ) with freezegun.freeze_time(datetime(2021, 11, 4, 7)): From 2de272a1a44fec0c1b74539241b236eb9a6c0774 Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Mon, 20 Jan 2025 10:31:25 +0000 Subject: [PATCH 2/6] Remove Python 3.11 from apt packages --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0747581..2a3dc58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: run: sudo systemctl start mysql.service - uses: actions/checkout@v4 - name: Install system Python build deps for psycopg2 - run: sudo apt-get install python3-dev python3.11-dev + run: sudo apt-get install python3-dev - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: From 3dd1843f72a7c9abdd0a29b208c8ac755750342e Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Mon, 20 Jan 2025 10:35:02 +0000 Subject: [PATCH 3/6] Exclude 3.13 builds from unsupported Django versions --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a3dc58..02ec500 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,10 @@ jobs: django: "5.0" - python: "3.9" django: "5.1" + - python: "3.13" + django: "4.2" + - python: "3.13" + django: "5.0" database_url: - postgres://runner:password@localhost/project - mysql://root:root@127.0.0.1/project From d797d37b10251026bc73974a93652b4df166e348 Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Mon, 20 Jan 2025 10:41:52 +0000 Subject: [PATCH 4/6] Install the latest point release of each Django and Python version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02ec500..fbef003 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,13 +47,13 @@ jobs: - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python }} + python-version: ${{ matrix.python }}.* - name: Upgraded pip run: pip install --upgrade pip - name: Install dependencies run: pip install -r test-requirements.txt - name: Install Django - run: pip install -U django==${{ matrix.django }} + run: pip install -U django~=${{ matrix.django }}.0 - name: Run tests run: python manage.py test - name: Run black From e9f234798ff1d367833e2689bfe53341331e3d9b Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Mon, 20 Jan 2025 10:46:20 +0000 Subject: [PATCH 5/6] Upgrade test requirements --- django_dbq/tests.py | 2 +- test-requirements.txt | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/django_dbq/tests.py b/django_dbq/tests.py index ba80b7f..f755666 100644 --- a/django_dbq/tests.py +++ b/django_dbq/tests.py @@ -1,5 +1,5 @@ from datetime import datetime, timedelta, timezone as datetime_timezone -import mock +from unittest import mock import freezegun from django.core.management import call_command diff --git a/test-requirements.txt b/test-requirements.txt index f5b2998..93545b8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,5 @@ -mysqlclient==1.4.6 -freezegun==0.3.12 -mock==3.0.5 -dj-database-url==0.5.0 -psycopg2==2.9.5 -black==24.3.0 +mysqlclient==2.2.7 +freezegun==1.5.1 +dj-database-url==2.3.0 +psycopg2==2.9.10 +black==24.10.0 From e0c7f18e07a34b421e180df37653f1baa130bfad Mon Sep 17 00:00:00 2001 From: Jamie Matthews Date: Mon, 20 Jan 2025 10:47:32 +0000 Subject: [PATCH 6/6] Bump versions in setup.py --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 5bb0f76..fda66ff 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ author_email = "contact@dabapps.com" license = "BSD" install_requires = [ - "Django>=3.1", + "Django>=4.2", ] long_description = """Simple database-backed job queue system""" @@ -82,5 +82,5 @@ def get_package_data(package): package_data=get_package_data(package), install_requires=install_requires, classifiers=[], - python_requires=">=3.6" + python_requires=">=3.9" )