diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80a3f249..ca0420c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,10 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false max-parallel: 4 matrix: - python-version: ['py38'] + python-version: ['py38', 'py312'] django-version: ['django42'] db-version: ['mysql80'] @@ -26,6 +27,11 @@ jobs: run: | docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api \ /bin/bash -c "apt-get update && apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config" + - name: setup python + if: ${{ matrix.python-version == 'py312' }} + run: | + docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api \ + /bin/bash -c "add-apt-repository ppa:deadsnakes/ppa -y && apt install python3.12 python3.12-dev python3.12-distutils -y" - name: Run Tests run: | docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.ci/run_tests.sh diff --git a/.github/workflows/migrations-mysql8-check.yml b/.github/workflows/migrations-mysql8-check.yml index 3f42fe61..96a687a3 100644 --- a/.github/workflows/migrations-mysql8-check.yml +++ b/.github/workflows/migrations-mysql8-check.yml @@ -12,9 +12,10 @@ jobs: name: check migrations runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ ubuntu-20.04 ] - python-version: [ 3.8 ] + python-version: [ '3.8', '3.12' ] steps: - name: Checkout repo diff --git a/notesapi/v1/tests/test_views.py b/notesapi/v1/tests/test_views.py index 9a3875ec..33de6763 100644 --- a/notesapi/v1/tests/test_views.py +++ b/notesapi/v1/tests/test_views.py @@ -1,3 +1,4 @@ +import sys import unittest from calendar import timegm from datetime import datetime, timedelta @@ -387,9 +388,14 @@ def test_read_all_no_annotations(self): headers["course_id"] = "a/b/c" response = self.client.get(reverse('api:v1:annotations'), headers) self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertDictContainsSubset( - {'total': 0, 'rows': []}, response.data, "no annotation should be returned in response" - ) + if sys.version_info[1] == 12: # python 3.12 + self.assertEqual( + {'total': 0, 'rows': []} | response.data, response.data, "no annotation should be returned in response" + ) + else: # remove this code after removing python 3.8 dependency + self.assertDictContainsSubset( + {'total': 0, 'rows': []}, response.data, "no annotation should be returned in response" + ) def test_read_all(self): """ diff --git a/requirements/base.txt b/requirements/base.txt index 792a1f23..a4337426 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -6,8 +6,10 @@ # asgiref==3.7.2 # via django -backports-zoneinfo==0.2.1 - # via django +backports-zoneinfo==0.2.1 ; python_version < "3.9" + # via + # -c requirements/constraints.txt + # django certifi==2024.2.2 # via # elasticsearch @@ -20,11 +22,11 @@ chardet==3.0.4 # via requests click==8.1.7 # via edx-django-utils -cryptography==42.0.2 +cryptography==42.0.5 # via pyjwt -django==4.2.10 +django==4.2.11 # via - # -c requirements/constraints.txt + # -c requirements/common_constraints.txt # -r requirements/base.in # django-cors-headers # django-crum @@ -97,7 +99,7 @@ inflection==0.5.1 # via drf-yasg mysqlclient==2.2.4 # via -r requirements/base.in -newrelic==9.6.0 +newrelic==9.7.0 # via # -r requirements/base.in # edx-django-utils @@ -154,11 +156,11 @@ six==1.16.0 # python-dateutil sqlparse==0.4.4 # via django -stevedore==5.1.0 +stevedore==5.2.0 # via # edx-django-utils # edx-opaque-keys -typing-extensions==4.9.0 +typing-extensions==4.10.0 # via # asgiref # edx-opaque-keys diff --git a/requirements/ci.txt b/requirements/ci.txt index 742e39c1..88a39ff7 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -4,7 +4,7 @@ # # make upgrade # -cachetools==5.3.2 +cachetools==5.3.3 # via tox chardet==5.2.0 # via tox @@ -32,7 +32,7 @@ tomli==2.0.1 # via # pyproject-api # tox -tox==4.12.1 +tox==4.13.0 # via -r requirements/ci.in -virtualenv==20.25.0 +virtualenv==20.25.1 # via tox diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt new file mode 100644 index 00000000..17334ce6 --- /dev/null +++ b/requirements/common_constraints.txt @@ -0,0 +1,28 @@ +# This is a temporary solution to override the real common_constraints.txt +# In edx-lint, until the pyjwt constraint in edx-lint has been removed. +# See BOM-2721 for more details. +# Below is the copied and edited version of common_constraints + +# A central location for most common version constraints +# (across edx repos) for pip-installation. +# +# Similar to other constraint files this file doesn't install any packages. +# It specifies version constraints that will be applied if a package is needed. +# When pinning something here, please provide an explanation of why it is a good +# idea to pin this package across all edx repos, Ideally, link to other information +# that will help people in the future to remove the pin when possible. +# Writing an issue against the offending project and linking to it here is good. +# +# Note: Changes to this file will automatically be used by other repos, referencing +# this file from Github directly. It does not require packaging in edx-lint. + + +# using LTS django version +Django<5.0 + +# elasticsearch>=7.14.0 includes breaking changes in it which caused issues in discovery upgrade process. +# elastic search changelog: https://www.elastic.co/guide/en/enterprise-search/master/release-notes-7.14.0.html +elasticsearch<7.14.0 + +# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected +django-simple-history==3.0.0 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 1b10609f..82a8b526 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -22,5 +22,5 @@ more-itertools==5.0.0 pylint==1.5.0 django-cors-headers==3.14.0 -# Stay on LTS -Django<5.0 + +backports-zoneinfo==0.2.1; python_version < '3.9' diff --git a/requirements/django.txt b/requirements/django.txt index 1facfe28..db03776f 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==4.2.10 +django==4.2.11 diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 0e882265..8528adba 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -4,7 +4,7 @@ # # make upgrade # -build==1.0.3 +build==1.1.1 # via pip-tools click==8.1.7 # via pip-tools @@ -12,10 +12,12 @@ importlib-metadata==7.0.1 # via build packaging==23.2 # via build -pip-tools==7.3.0 +pip-tools==7.4.0 # via -r requirements/pip-tools.in pyproject-hooks==1.0.0 - # via build + # via + # build + # pip-tools tomli==2.0.1 # via # build diff --git a/requirements/pip.txt b/requirements/pip.txt index 71954cc6..66656035 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -10,5 +10,5 @@ wheel==0.42.0 # The following packages are considered to be unsafe in a requirements file: pip==24.0 # via -r requirements/pip.in -setuptools==69.1.0 +setuptools==69.1.1 # via -r requirements/pip.in diff --git a/requirements/test.txt b/requirements/test.txt index 830c7e80..4b67dabf 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -13,8 +13,9 @@ astroid==1.6.6 # -c requirements/constraints.txt # -r requirements/test.in # pylint -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1 ; python_version < "3.9" # via + # -c requirements/constraints.txt # -r requirements/base.txt # django certifi==2024.2.2 @@ -41,22 +42,22 @@ code-annotations==1.6.0 # via -r requirements/test.in colorama==0.4.6 # via pylint -coverage[toml]==7.4.1 +coverage[toml]==7.4.3 # via # -r requirements/test.in # pytest-cov -cryptography==42.0.2 +cryptography==42.0.5 # via # -r requirements/base.txt # pyjwt -ddt==1.7.1 +ddt==1.7.2 # via -r requirements/test.in diff-cover==8.0.3 # via -r requirements/test.in distlib==0.3.8 # via virtualenv # via - # -c requirements/constraints.txt + # -c requirements/common_constraints.txt # -r requirements/base.txt # django-cors-headers # django-crum @@ -134,7 +135,7 @@ exceptiongroup==1.2.0 # via pytest factory-boy==3.3.0 # via -r requirements/test.in -faker==23.2.0 +faker==24.0.0 # via factory-boy filelock==3.13.1 # via @@ -166,7 +167,7 @@ more-itertools==5.0.0 # -r requirements/test.in mysqlclient==2.2.4 # via -r requirements/base.txt -newrelic==9.6.0 +newrelic==9.7.0 # via # -r requirements/base.txt # edx-django-utils @@ -212,7 +213,6 @@ pyjwt[crypto]==2.8.0 # -r requirements/base.txt # drf-jwt # edx-drf-extensions - # pyjwt pylint==1.5.0 # via # -c requirements/constraints.txt @@ -225,7 +225,7 @@ pynacl==1.5.0 # via # -r requirements/base.txt # edx-django-utils -pytest==8.0.0 +pytest==8.0.2 # via # -r requirements/test.in # pytest-cov @@ -278,7 +278,7 @@ sqlparse==0.4.4 # via # -r requirements/base.txt # django -stevedore==5.1.0 +stevedore==5.2.0 # via # -r requirements/base.txt # code-annotations @@ -293,7 +293,7 @@ tomli==2.0.1 # tox tox==3.28.0 # via -r requirements/test.in -typing-extensions==4.9.0 +typing-extensions==4.10.0 # via # -r requirements/base.txt # asgiref @@ -308,7 +308,7 @@ urllib3==1.26.18 # -r requirements/base.txt # elasticsearch # requests -virtualenv==20.25.0 +virtualenv==20.25.1 # via tox wrapt==1.16.0 # via astroid diff --git a/tox.ini b/tox.ini index f330f3f3..ccfbfc50 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,13 @@ [tox] -envlist = py38-django{42} +envlist = py{38,312}-django{42} skipsdist = true [testenv] -deps = - django42: Django>=4.2,<4.3 +deps = + setuptools + django42: Django>=4.2,<5.0 -r {toxinidir}/requirements/test.txt -passenv = +passenv = CONN_MAX_AGE DB_ENGINE DB_HOST @@ -16,7 +17,7 @@ passenv = DB_USER ENABLE_DJANGO_TOOLBAR ELASTICSEARCH_URL -allowlist_externals = +allowlist_externals = make -commands = +commands = make validate