From b0a4207d45424e162ce0729542587dbe0be65fe0 Mon Sep 17 00:00:00 2001 From: Muhammad Soban Javed <58461728+iamsobanjaved@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:32:30 +0500 Subject: [PATCH] feat!: upgrade to Django 4.2 (#372) * feat!: upgrade to Django 4.2 * fix: use local copy of common_constraints file * chore: Updating Python Requirements --------- Co-authored-by: Muhammad Soban Javed Co-authored-by: edX requirements bot --- .github/workflows/ci.yml | 9 ++----- .travis/docker-compose-travis.yml | 11 --------- Makefile | 13 ++++++++++- requirements/base.txt | 19 ++++++++------- requirements/constraints.txt | 5 +++- requirements/django.txt | 2 +- requirements/pip-tools.txt | 2 +- requirements/pip.txt | 4 ++-- requirements/test.txt | 39 +++++++++++++++++-------------- requirements/travis.txt | 31 +++++++++++++++--------- tox.ini | 3 +-- 11 files changed, 74 insertions(+), 64 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b88e855b..5e00b0c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,13 +14,8 @@ jobs: max-parallel: 4 matrix: python-version: ['py38'] - django-version: ['django32', 'django42'] - db-version: ['mysql57', 'mysql80'] - # excluding mysql5.7 with Django 4.2 since Django 4.2 has - # dropped support for MySQL<8 - exclude: - - django-version: 'django42' - db-version: 'mysql57' + django-version: ['django42'] + db-version: ['mysql80'] steps: - uses: actions/checkout@v2 diff --git a/.travis/docker-compose-travis.yml b/.travis/docker-compose-travis.yml index 26eb6c5c..2a043599 100644 --- a/.travis/docker-compose-travis.yml +++ b/.travis/docker-compose-travis.yml @@ -1,16 +1,6 @@ version: "2" services: - mysql57: - image: mysql:5.7 - container_name: mysql57 - command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci - environment: - MYSQL_ROOT_PASSWORD: "" - MYSQL_ALLOW_EMPTY_PASSWORD: "yes" - MYSQL_USER: "notes001" - MYSQL_PASSWORD: "secret" - MYSQL_DATABASE: "edx_notes_api" mysql80: image: mysql:8.0 container_name: mysql80 @@ -49,7 +39,6 @@ services: - ..:/edx/app/edx_notes_api/edx_notes_api command: tail -f /dev/null depends_on: - - "mysql57" - "mysql80" - "es" environment: diff --git a/Makefile b/Makefile index 31b6973c..1e9066e3 100644 --- a/Makefile +++ b/Makefile @@ -65,15 +65,26 @@ develop: requirements test.requirements piptools: ## install pinned version of pip-compile and pip-sync pip install -r requirements/pip-tools.txt +define COMMON_CONSTRAINTS_TEMP_COMMENT +# This is a temporary solution to override the real common_constraints.txt\n# In edx-lint, until the pyjwt constraint in edx-lint has been removed.\n# See BOM-2721 for more details.\n# Below is the copied and edited version of common_constraints\n +endef +COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt +.PHONY: $(COMMON_CONSTRAINTS_TXT) +$(COMMON_CONSTRAINTS_TXT): + wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)" + echo "$(COMMON_CONSTRAINTS_TEMP_COMMENT)" | cat - $(@) > temp && mv temp $(@) + upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade -upgrade: piptools ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in +upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in # Make sure to compile files after any other files they include! + sed -i.'' 's/Django<4.0//g' requirements/common_constraints.txt pip-compile --upgrade --rebuild --allow-unsafe -o requirements/pip.txt requirements/pip.in pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in pip install -qr requirements/pip.txt pip install -qr requirements/pip-tools.txt pip-compile --upgrade -o requirements/base.txt requirements/base.in pip-compile --upgrade -o requirements/test.txt requirements/test.in + pip-compile --upgrade -o requirements/travis.txt requirements/travis.in # Let tox control the Django version for tests grep -e "^django==" requirements/base.txt > requirements/django.txt sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp diff --git a/requirements/base.txt b/requirements/base.txt index 5f356ecc..84bcd9a4 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -6,7 +6,9 @@ # asgiref==3.7.2 # via django -certifi==2023.7.22 +backports-zoneinfo==0.2.1 + # via django +certifi==2023.11.17 # via # elasticsearch # requests @@ -18,11 +20,11 @@ chardet==3.0.4 # via requests click==8.1.7 # via edx-django-utils -cryptography==41.0.4 +cryptography==41.0.5 # via pyjwt -django==3.2.22 +django==4.2.7 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/constraints.txt # -r requirements/base.in # django-cors-headers # django-crum @@ -66,7 +68,7 @@ drf-yasg==1.21.7 # via -r requirements/base.in edx-django-release-util==1.3.0 # via -r requirements/base.in -edx-django-utils==5.7.0 +edx-django-utils==5.8.0 # via # -r requirements/base.in # edx-drf-extensions @@ -76,7 +78,7 @@ edx-opaque-keys==2.5.1 # via edx-drf-extensions elasticsearch==7.13.4 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.in # django-elasticsearch-dsl-drf @@ -95,7 +97,7 @@ inflection==0.5.1 # via drf-yasg mysqlclient==2.2.0 # via -r requirements/base.in -newrelic==9.1.2 +newrelic==9.2.0 # via # -r requirements/base.in # edx-django-utils @@ -108,7 +110,7 @@ path-py==9.1 # via # -c requirements/constraints.txt # -r requirements/base.in -pbr==5.11.1 +pbr==6.0.0 # via stevedore psutil==5.9.6 # via edx-django-utils @@ -130,7 +132,6 @@ python-dateutil==2.4.0 # elasticsearch-dsl pytz==2023.3.post1 # via - # django # djangorestframework # drf-yasg pyyaml==6.0.1 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index d8b122a3..1b10609f 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -9,7 +9,7 @@ # linking to it here is good. # This file contains all common constraints for edx-repos --c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt +-c common_constraints.txt astroid==1.6.6 requests==2.25.0 @@ -21,3 +21,6 @@ python-dateutil==2.4.0 more-itertools==5.0.0 pylint==1.5.0 django-cors-headers==3.14.0 + +# Stay on LTS +Django<5.0 diff --git a/requirements/django.txt b/requirements/django.txt index 5a28da34..a6bbbf6c 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==3.2.22 +django==4.2.7 diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 50d35f22..ea347319 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -21,7 +21,7 @@ tomli==2.0.1 # build # pip-tools # pyproject-hooks -wheel==0.41.2 +wheel==0.41.3 # via pip-tools zipp==3.17.0 # via importlib-metadata diff --git a/requirements/pip.txt b/requirements/pip.txt index 2154d29f..9014f2cf 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -4,11 +4,11 @@ # # make upgrade # -wheel==0.41.2 +wheel==0.41.3 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: -pip==23.3 +pip==23.3.1 # via -r requirements/pip.in setuptools==68.2.2 # via -r requirements/pip.in diff --git a/requirements/test.txt b/requirements/test.txt index 43489ab9..9f13018f 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -13,7 +13,11 @@ astroid==1.6.6 # -c requirements/constraints.txt # -r requirements/test.in # pylint -certifi==2023.7.22 +backports-zoneinfo==0.2.1 + # via + # -r requirements/base.txt + # django +certifi==2023.11.17 # via # -r requirements/base.txt # elasticsearch @@ -41,18 +45,18 @@ coverage[toml]==7.3.2 # via # -r requirements/test.in # pytest-cov -cryptography==41.0.4 +cryptography==41.0.5 # via # -r requirements/base.txt # pyjwt -ddt==1.6.0 +ddt==1.7.0 # via -r requirements/test.in -diff-cover==7.7.0 +diff-cover==8.0.1 # via -r requirements/test.in distlib==0.3.7 # via virtualenv # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/constraints.txt # -r requirements/base.txt # django-cors-headers # django-crum @@ -103,7 +107,7 @@ drf-yasg==1.21.7 # via -r requirements/base.txt edx-django-release-util==1.3.0 # via -r requirements/base.txt -edx-django-utils==5.7.0 +edx-django-utils==5.8.0 # via # -r requirements/base.txt # edx-drf-extensions @@ -115,7 +119,7 @@ edx-opaque-keys==2.5.1 # edx-drf-extensions elasticsearch==7.13.4 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.txt # django-elasticsearch-dsl-drf @@ -130,9 +134,9 @@ exceptiongroup==1.1.3 # via pytest factory-boy==3.3.0 # via -r requirements/test.in -faker==19.11.0 +faker==20.0.3 # via factory-boy -filelock==3.12.4 +filelock==3.13.1 # via # tox # virtualenv @@ -162,7 +166,7 @@ more-itertools==5.0.0 # -r requirements/test.in mysqlclient==2.2.0 # via -r requirements/base.txt -newrelic==9.1.2 +newrelic==9.2.0 # via # -r requirements/base.txt # edx-django-utils @@ -178,7 +182,7 @@ path-py==9.1 # via # -c requirements/constraints.txt # -r requirements/base.txt -pbr==5.11.1 +pbr==6.0.0 # via # -r requirements/base.txt # stevedore @@ -186,7 +190,7 @@ pep8==1.7.1 # via -r requirements/test.in platformdirs==3.11.0 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # virtualenv pluggy==1.3.0 # via @@ -203,7 +207,7 @@ pycparser==2.21 # via # -r requirements/base.txt # cffi -pygments==2.16.1 +pygments==2.17.1 # via diff-cover pyjwt[crypto]==2.8.0 # via @@ -223,14 +227,14 @@ pynacl==1.5.0 # via # -r requirements/base.txt # edx-django-utils -pytest==7.4.2 +pytest==7.4.3 # via # -r requirements/test.in # pytest-cov # pytest-django pytest-cov==4.1.0 # via -r requirements/test.in -pytest-django==4.5.2 +pytest-django==4.7.0 # via -r requirements/test.in python-dateutil==2.4.0 # via @@ -243,7 +247,6 @@ python-slugify==8.0.1 pytz==2023.3.post1 # via # -r requirements/base.txt - # django # djangorestframework # drf-yasg pyyaml==6.0.1 @@ -307,7 +310,7 @@ urllib3==1.26.18 # -r requirements/base.txt # elasticsearch # requests -virtualenv==20.24.5 +virtualenv==20.24.6 # via tox -wrapt==1.15.0 +wrapt==1.16.0 # via astroid diff --git a/requirements/travis.txt b/requirements/travis.txt index 41d7e43c..cc0b0f89 100644 --- a/requirements/travis.txt +++ b/requirements/travis.txt @@ -4,27 +4,36 @@ # # make upgrade # +cachetools==5.3.2 + # via tox +chardet==5.2.0 + # via tox +colorama==0.4.6 + # via tox distlib==0.3.7 # via virtualenv -filelock==3.12.4 +filelock==3.13.1 # via # tox # virtualenv packaging==23.2 - # via tox + # via + # pyproject-api + # tox platformdirs==3.11.0 - # via virtualenv + # via + # -c requirements/common_constraints.txt + # tox + # virtualenv pluggy==1.3.0 # via tox -py==1.11.0 - # via tox -six==1.16.0 +pyproject-api==1.6.1 # via tox tomli==2.0.1 - # via tox -tox==3.28.0 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt - # -r requirements/travis.in -virtualenv==20.24.5 + # pyproject-api + # tox +tox==4.11.3 + # via -r requirements/travis.in +virtualenv==20.24.6 # via tox diff --git a/tox.ini b/tox.ini index b3de5f58..f330f3f3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,9 @@ [tox] -envlist = py38-django{32, 42} +envlist = py38-django{42} skipsdist = true [testenv] deps = - django32: Django>=3.2,<4.0 django42: Django>=4.2,<4.3 -r {toxinidir}/requirements/test.txt passenv =