-
Notifications
You must be signed in to change notification settings - Fork 3
Add support for Python 3.14 + Django 5.2 + drop end-of-life versions #17
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,6 @@ __pycache__ | |
| db.sqlite3 | ||
| build/* | ||
| tests/static/* | ||
| .python-version | ||
| .coverage | ||
| uv.lock | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # Generated by Django 3.2.22 on 2023-10-20 15:42 | ||
|
|
||
| import django | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
|
|
@@ -27,6 +28,15 @@ class Migration(migrations.Migration): | |
| _connector="OR", | ||
| ), | ||
| name="not_both_not_null", | ||
| ) | ||
| if django.VERSION < (5, 1) | ||
|
Comment on lines
+31
to
+32
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| else models.CheckConstraint( | ||
| condition=models.Q( | ||
| ("end_time__isnull", True), | ||
| ("max_number_of_executions__isnull", True), | ||
| _connector="OR", | ||
| ), | ||
| name="not_both_not_null", | ||
| ), | ||
| ), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,10 @@ | ||
| import datetime | ||
|
|
||
| import croniter | ||
| import django | ||
| from django.conf import settings | ||
| from django.core.exceptions import ValidationError | ||
| from django.db import models | ||
| from django.db.models import JSONField, Q | ||
| from django.utils import timezone | ||
| from django.utils.dateformat import format | ||
| from django.utils import dateformat, timezone | ||
| from django.utils.translation import gettext_lazy as _ | ||
|
|
||
| from .fields import FutureTaskCronField | ||
|
|
@@ -106,18 +104,16 @@ def next_planned_execution(self): | |
| not self.is_active | ||
| or ( | ||
| self.max_number_of_executions is not None | ||
| and FutureTask.objects.filter(periodic_parent_task=self.pk).count() | ||
| >= self.max_number_of_executions | ||
| and FutureTask.objects.filter(periodic_parent_task=self.pk).count() >= self.max_number_of_executions | ||
| ) | ||
| or ( | ||
| self.end_time is not None | ||
| and self.end_time | ||
| < croniter.croniter(self.cron_string, now).get_next(timezone.datetime) | ||
| and self.end_time < croniter.croniter(self.cron_string, now).get_next(timezone.datetime) | ||
| ) | ||
| ): | ||
| return None | ||
|
|
||
| return format( | ||
| return dateformat.format( | ||
| timezone.template_localtime(next_planned_execution), | ||
| settings.DATETIME_FORMAT, | ||
| ) | ||
|
|
@@ -134,7 +130,7 @@ def save( | |
| update_fields=None, | ||
| ): | ||
| if self.is_active and not self.__original_is_active: | ||
| self.last_task_creation = datetime.datetime.now() | ||
| self.last_task_creation = timezone.now() | ||
|
Comment on lines
-137
to
+133
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be the cause of the duplicated tasks that you encountered @nezhar . |
||
|
|
||
| self.clean() | ||
| super().save() | ||
|
|
@@ -159,8 +155,12 @@ def clean(self): | |
| class Meta: | ||
| constraints = [ | ||
| models.CheckConstraint( | ||
| check=Q(end_time__isnull=True) | ||
| | Q(max_number_of_executions__isnull=True), | ||
| check=Q(end_time__isnull=True) | Q(max_number_of_executions__isnull=True), | ||
| name="not_both_not_null", | ||
| ) | ||
| if django.VERSION < (5, 1) | ||
| else models.CheckConstraint( | ||
| condition=Q(end_time__isnull=True) | Q(max_number_of_executions__isnull=True), | ||
| name="not_both_not_null", | ||
| ), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| [project] | ||
| name = "django-future-tasks" | ||
| description = "A library to create periodic, cron-like tasks or single tasks with a specified execution/start time and schedule it to run in the future." | ||
| readme = "README.md" | ||
| requires-python = ">=3.10" | ||
| license = {text = "MIT"} | ||
| authors = [ | ||
| {name = "Armin Ster", email = "aster@anexia-it.com"}, | ||
| ] | ||
| classifiers = [ | ||
| "Development Status :: 5 - Production/Stable", | ||
| "Framework :: Django", | ||
| "Framework :: Django :: 4.2", | ||
| "Framework :: Django :: 5.1", | ||
| "Framework :: Django :: 5.2", | ||
| "Intended Audience :: Developers", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Programming Language :: Python :: 3.14", | ||
| ] | ||
| dynamic = ["version"] | ||
| dependencies = [ | ||
| "croniter>=3.0.3,<6.0", | ||
| "django-cronfield>=0.2.0,<0.3", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "django>=4.2,<6.0", | ||
| "pre-commit>=4.3,<4.4", | ||
| "pytest>=8.4,<8.5", | ||
| "pytest-cov>=7.0,<7.1", | ||
| "pytest-django>=4.11,<4.12", | ||
| "time-machine>=2.19.0,<2.20.0", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/anexia/django-future-tasks" | ||
| Documentation = "https://github.com/anexia/django-future-tasks/blob/main/README.md" | ||
| Repository = "https://github.com/anexia/django-future-tasks" | ||
| Issues = "https://github.com/anexia/django-future-tasks/issues" | ||
| Changelog = "https://github.com/anexia/django-future-tasks/blob/main/CHANGELOG.md" | ||
|
|
||
| [tool.pytest.ini_options] | ||
| DJANGO_SETTINGS_MODULE = "core.settings" | ||
| filterwarnings = ["error", "ignore::ResourceWarning"] | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a |
||
|
|
||
| [build-system] | ||
| requires = ["setuptools"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.ruff] | ||
| line-length = 120 | ||
| respect-gitignore = true | ||
| extend-exclude = [".venv", "__pycache__"] | ||
| show-fixes = true | ||
|
|
||
| [tool.ruff.format] | ||
| quote-style = "double" | ||
|
|
||
| [tool.ruff.lint] | ||
| select = ["A", "B", "C", "E", "F", "W", "T20", "LOG", "I", "UP", "RUF010", "RUF019"] | ||
| ignore = ["E203", "E266", "E501", "F403", "F405"] | ||
|
Comment on lines
+66
to
+68
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I threw our usual config in there after noticing that imports were not automatically sorted and fixed all the issues that popped up because of the stricter config. |
||
|
|
||
| [tool.ruff.lint.isort] | ||
| known-first-party = ["django_future_tasks", "core"] | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the unreleased section. 🙃 I can change this in the other pull request and rebase next week.