From 8115d8b7433b9f4b1fffe7072daa92f137a9a52b Mon Sep 17 00:00:00 2001 From: irtazaakram Date: Tue, 29 Aug 2023 12:24:46 +0500 Subject: [PATCH] feat!: Upgrade to Django 4.2 --- .github/workflows/ci.yml | 4 ++-- Makefile | 2 ++ registrar/settings/base.py | 3 +++ requirements/base.txt | 6 +++--- requirements/common_constraints.txt | 2 +- requirements/constraints.txt | 3 ++- requirements/devstack.txt | 8 +++++--- requirements/django.txt | 2 +- requirements/local.txt | 8 +++++--- requirements/monitoring/requirements.txt | 10 ++++++++-- requirements/production.txt | 8 +++++--- requirements/test.txt | 6 ++++-- tox.ini | 6 +++--- 13 files changed, 44 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf9c69d9..ce02c6d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - ubuntu-20.04 python-version: - 3.8 - toxenv: [ django32 ] + toxenv: [ django42 ] steps: - uses: actions/checkout@v1 - name: setup python @@ -45,7 +45,7 @@ jobs: make static make validate_translations - name: Run Coverage - if: matrix.python-version == '3.8' && matrix.toxenv=='django32' + if: matrix.python-version == '3.8' && matrix.toxenv=='django42' uses: codecov/codecov-action@v1 with: flags: unittests diff --git a/Makefile b/Makefile index 2e93f5b3..e5d30f20 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,8 @@ upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## re-compile requirements .txt files from .in files sed 's/django-simple-history==3.0.0//g' requirements/common_constraints.txt > requirements/common_constraints.tmp mv requirements/common_constraints.tmp requirements/common_constraints.txt + sed 's/Django<4.0//g' requirements/common_constraints.txt > requirements/common_constraints.tmp + mv requirements/common_constraints.tmp requirements/common_constraints.txt pip-compile --allow-unsafe --rebuild --upgrade -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 diff --git a/registrar/settings/base.py b/registrar/settings/base.py index 8290fcb2..47767097 100644 --- a/registrar/settings/base.py +++ b/registrar/settings/base.py @@ -341,3 +341,6 @@ # disable indexing on history_date SIMPLE_HISTORY_DATE_INDEX = False + +# Keep using deprecated pytz for Django>4 +USE_DEPRECATED_PYTZ = True diff --git a/requirements/base.txt b/requirements/base.txt index d0143f24..51b54111 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -14,6 +14,8 @@ async-timeout==4.0.3 # via redis backoff==1.10.0 # via analytics-python +backports-zoneinfo==0.2.1 + # via django billiard==3.6.4.0 # via celery celery==4.4.7 @@ -39,9 +41,8 @@ defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core -django==3.2.22 +django==4.2.6 # via - # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.in # django-cors-headers @@ -164,7 +165,6 @@ pytz==2023.3.post1 # via # -r requirements/base.in # celery - # django # djangorestframework # drf-yasg pyyaml==6.0.1 diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index 18ff1b20..a5676767 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -18,7 +18,7 @@ # using LTS django version -Django<4.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 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 83e08183..eca21e89 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -11,7 +11,8 @@ # Common constraints for edx repos -c common_constraints.txt -Django<4.0 +# This constraint can be removed once global constraint is updated. +Django<4.3 # Version 3.2.0 contains bad arabic translations that will cause validation tests to fail django-extensions<3.2.0 diff --git a/requirements/devstack.txt b/requirements/devstack.txt index 818dfb69..dc9b1669 100644 --- a/requirements/devstack.txt +++ b/requirements/devstack.txt @@ -40,6 +40,10 @@ backoff==1.10.0 # via # -r requirements/local.txt # analytics-python +backports-zoneinfo==0.2.1 + # via + # -r requirements/local.txt + # django beautifulsoup4==4.12.2 # via # -r requirements/local.txt @@ -122,9 +126,8 @@ distlib==0.3.7 # via # -r requirements/local.txt # virtualenv -django==3.2.22 +django==4.2.6 # via - # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/local.txt # django-cors-headers @@ -452,7 +455,6 @@ pytz==2023.3.post1 # -r requirements/local.txt # babel # celery - # django # djangorestframework # drf-yasg pywatchman==1.4.1 diff --git a/requirements/django.txt b/requirements/django.txt index 5a28da34..7ac6d4fc 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==3.2.22 +django==4.2.6 diff --git a/requirements/local.txt b/requirements/local.txt index 8fd6993d..5b96b97c 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -40,6 +40,10 @@ backoff==1.10.0 # via # -r requirements/test.txt # analytics-python +backports-zoneinfo==0.2.1 + # via + # -r requirements/test.txt + # django beautifulsoup4==4.12.2 # via # -r requirements/docs.txt @@ -122,9 +126,8 @@ distlib==0.3.7 # via # -r requirements/test.txt # virtualenv -django==3.2.22 +django==4.2.6 # via - # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/test.txt # django-cors-headers @@ -443,7 +446,6 @@ pytz==2023.3.post1 # -r requirements/test.txt # babel # celery - # django # djangorestframework # drf-yasg pywatchman==1.4.1 diff --git a/requirements/monitoring/requirements.txt b/requirements/monitoring/requirements.txt index 0dad520c..0d86921d 100644 --- a/requirements/monitoring/requirements.txt +++ b/requirements/monitoring/requirements.txt @@ -61,6 +61,13 @@ backoff==1.10.0 # -r requirements/monitoring/../production.txt # -r requirements/monitoring/../test.txt # analytics-python +backports-zoneinfo==0.2.1 + # via + # -r requirements/monitoring/../devstack.txt + # -r requirements/monitoring/../local.txt + # -r requirements/monitoring/../production.txt + # -r requirements/monitoring/../test.txt + # django beautifulsoup4==4.12.2 # via # -r requirements/monitoring/../devstack.txt @@ -185,7 +192,7 @@ distlib==0.3.7 # -r requirements/monitoring/../local.txt # -r requirements/monitoring/../test.txt # virtualenv -django==3.2.22 +django==4.2.6 # via # -r requirements/monitoring/../devstack.txt # -r requirements/monitoring/../local.txt @@ -724,7 +731,6 @@ pytz==2023.3.post1 # -r requirements/monitoring/../test.txt # babel # celery - # django # djangorestframework # drf-yasg pywatchman==1.4.1 diff --git a/requirements/production.txt b/requirements/production.txt index 49588c74..48b3ad05 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -22,6 +22,10 @@ backoff==1.10.0 # via # -r requirements/base.txt # analytics-python +backports-zoneinfo==0.2.1 + # via + # -r requirements/base.txt + # django billiard==3.6.4.0 # via # -r requirements/base.txt @@ -66,9 +70,8 @@ defusedxml==0.8.0rc2 # -r requirements/base.txt # python3-openid # social-auth-core -django==3.2.22 +django==4.2.6 # via - # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.txt # django-cors-headers @@ -246,7 +249,6 @@ pytz==2023.3.post1 # via # -r requirements/base.txt # celery - # django # djangorestframework # drf-yasg pyyaml==6.0.1 diff --git a/requirements/test.txt b/requirements/test.txt index e944acce..7766a5b5 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -26,6 +26,10 @@ backoff==1.10.0 # via # -r requirements/base.txt # analytics-python +backports-zoneinfo==0.2.1 + # via + # -r requirements/base.txt + # django billiard==3.6.4.0 # via # -r requirements/base.txt @@ -93,7 +97,6 @@ dill==0.3.7 distlib==0.3.7 # via virtualenv # via - # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.txt # django-cors-headers @@ -340,7 +343,6 @@ pytz==2023.3.post1 # via # -r requirements/base.txt # celery - # django # djangorestframework # drf-yasg pyyaml==6.0.1 diff --git a/tox.ini b/tox.ini index 3b51ebe2..9f8c397e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,13 @@ [tox] -envlist = py38-django{32} +envlist = py38-django{42} skipsdist = true [testenv] passenv = * deps = - django32: -r requirements/django.txt + django42: -r requirements/django.txt -r{toxinidir}/requirements/test.txt whitelist_externals = i18n_tool /bin/bash -commands = {posargs:pytest} \ No newline at end of file +commands = {posargs:pytest}