diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83213b47..beeffcc7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: python-version: ["3.11", "3.12"] - toxenv: ["django42", "quality", "pii_check", "check_keywords"] + toxenv: ["django42", "django52", "quality", "pii_check", "check_keywords"] services: mysql: diff --git a/notesapi/v1/tests/helpers.py b/notesapi/v1/tests/helpers.py index 84ac49d7..0a7fd809 100644 --- a/notesapi/v1/tests/helpers.py +++ b/notesapi/v1/tests/helpers.py @@ -1,12 +1,12 @@ from calendar import timegm -from datetime import datetime, timedelta +from datetime import UTC, datetime, timedelta import jwt from django.conf import settings def get_id_token(user): - now = datetime.utcnow() + now = datetime.now(UTC) return jwt.encode({ 'aud': settings.CLIENT_ID, 'sub': user, diff --git a/notesapi/v1/tests/test_views.py b/notesapi/v1/tests/test_views.py index 750a61b9..8f7734dc 100644 --- a/notesapi/v1/tests/test_views.py +++ b/notesapi/v1/tests/test_views.py @@ -1,6 +1,6 @@ import unittest from calendar import timegm -from datetime import datetime, timedelta +from datetime import UTC, datetime, timedelta from unittest.mock import patch from urllib import parse @@ -1193,8 +1193,8 @@ class TokenTests(BaseAnnotationViewTests): token_data = { 'aud': settings.CLIENT_ID, 'sub': TEST_USER, - 'iat': timegm(datetime.utcnow().utctimetuple()), - 'exp': timegm((datetime.utcnow() + timedelta(seconds=300)).utctimetuple()), + 'iat': timegm(datetime.now(UTC).utctimetuple()), + 'exp': timegm((datetime.now(UTC) + timedelta(seconds=300)).utctimetuple()), } def _assert_403(self, token): diff --git a/notesapi/v1/views/common.py b/notesapi/v1/views/common.py index 944c82d5..e02ff047 100644 --- a/notesapi/v1/views/common.py +++ b/notesapi/v1/views/common.py @@ -1,4 +1,3 @@ -# pylint:disable=possibly-used-before-assignment import json import logging diff --git a/notesapi/v1/views/elasticsearch.py b/notesapi/v1/views/elasticsearch.py index 32c7207c..354683f7 100644 --- a/notesapi/v1/views/elasticsearch.py +++ b/notesapi/v1/views/elasticsearch.py @@ -66,12 +66,11 @@ class AnnotationSearchView(BaseAnnotationSearchView): def __init__(self, *args, **kwargs): self.client = connections.get_connection( NoteDocument._get_using() - ) # pylint: disable=protected-access - self.index = NoteDocument._index._name # pylint: disable=protected-access + ) + self.index = NoteDocument._index._name self.mapping = ( NoteDocument._doc_type.mapping.properties.name - ) # pylint: disable=protected-access - # pylint: disable=protected-access + ) self.search = Search( using=self.client, index=self.index, doc_type=NoteDocument._doc_type.name ) diff --git a/notesserver/settings/common.py b/notesserver/settings/common.py index 933f31cb..1efe9d72 100644 --- a/notesserver/settings/common.py +++ b/notesserver/settings/common.py @@ -158,8 +158,3 @@ } CSRF_TRUSTED_ORIGINS = [] - -# Django 4.0+ uses zoneinfo if this is not set. We can remove this and -# migrate to zoneinfo after Django 4.2 upgrade. See more on following url -# https://docs.djangoproject.com/en/4.2/releases/4.0/#zoneinfo-default-timezone-implementation -USE_DEPRECATED_PYTZ = True diff --git a/requirements/base.in b/requirements/base.in index 8be8c0bc..1a0076d8 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -2,22 +2,21 @@ -c constraints.txt Django -requests +django-cors-headers +django-elasticsearch-dsl +django-elasticsearch-dsl-drf djangorestframework drf-spectacular +edx-django-release-util +edx-django-utils +edx-drf-extensions elasticsearch elasticsearch-dsl -django-elasticsearch-dsl -django-elasticsearch-dsl-drf -django-cors-headers +gunicorn # MIT meilisearch mysqlclient -PyJWT -gunicorn # MIT path.py +PyJWT python-dateutil -edx-django-release-util -edx-django-utils -edx-drf-extensions -pytz +requests setuptools diff --git a/requirements/base.txt b/requirements/base.txt index e5490ee6..c8fb6ecb 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -139,8 +139,6 @@ python-dateutil==2.9.0.post0 # via # -r requirements/base.in # elasticsearch-dsl -pytz==2025.2 - # via -r requirements/base.in pyyaml==6.0.2 # via # drf-spectacular diff --git a/requirements/pip.in b/requirements/pip.in index 715478cd..b419ce6d 100644 --- a/requirements/pip.in +++ b/requirements/pip.in @@ -4,4 +4,3 @@ pip setuptools wheel - diff --git a/requirements/quality.in b/requirements/quality.in index e6451e75..55e5185a 100644 --- a/requirements/quality.in +++ b/requirements/quality.in @@ -4,6 +4,6 @@ -r test.txt code-annotations +edx_lint pycodestyle pylint -edx_lint diff --git a/requirements/quality.txt b/requirements/quality.txt index bce41720..2f093d87 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -381,10 +381,6 @@ python-slugify==8.0.4 # via # -r requirements/test.txt # code-annotations -pytz==2025.2 - # via - # -r requirements/base.txt - # -r requirements/test.txt pyyaml==6.0.2 # via # -r requirements/base.txt diff --git a/requirements/test.in b/requirements/test.in index c208272c..790cbb13 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -5,12 +5,12 @@ astroid code-annotations coverage +ddt +diff-cover +factory_boy more-itertools pep8 pylint -diff-cover -factory_boy -ddt pytest pytest-cov pytest-django diff --git a/requirements/test.txt b/requirements/test.txt index efe4e79f..fb52a0a1 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -272,8 +272,6 @@ python-dateutil==2.9.0.post0 # elasticsearch-dsl python-slugify==8.0.4 # via code-annotations -pytz==2025.2 - # via -r requirements/base.txt pyyaml==6.0.2 # via # -r requirements/base.txt diff --git a/tox.ini b/tox.ini index 2c64d0f9..98f5939a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{311,312}-django{42}, quality, pii_check, check_keywords +envlist = py{311,312}-django{42,52}, quality, pii_check, check_keywords skipsdist = true isolated_build = true # Enable isolated build environments @@ -7,6 +7,7 @@ isolated_build = true # Enable isolated build environments envdir = {toxworkdir}/{envname} deps = django42: Django>=4.2,<5.0 + django52: Django>=5.2,<6.0 passenv = CONN_MAX_AGE DB_ENGINE