From 2e50e81551f5e18580af1b6b9a608e78c4d9adec Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Sat, 7 Oct 2023 00:40:21 +0500 Subject: [PATCH] feat!: upgrade to django 4.2 LTS (#1511) * feat!: upgrade to django 4.2 LTS * fix: update settings for pytz --- .github/workflows/ci.yml | 2 +- Makefile | 2 ++ analytics_dashboard/settings/base.py | 3 +++ requirements/base.txt | 9 ++++----- requirements/common_constraints.txt | 2 +- requirements/constraints.txt | 4 ++-- requirements/django.txt | 2 +- requirements/django42.txt | 1 - requirements/doc.txt | 8 +++++--- requirements/local.txt | 8 +++++--- requirements/production.txt | 8 +++++--- requirements/test.txt | 6 ++++-- tox.ini | 5 ++--- 13 files changed, 35 insertions(+), 25 deletions(-) delete mode 100644 requirements/django42.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b152305ca..b042423e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: matrix: python-version: ["3.8"] os: [ubuntu-20.04] - toxenv: [django32, django42] + toxenv: [django42] node: [16] env: DATA_API_VERSION: "latest" diff --git a/Makefile b/Makefile index 27758ad9b..7f1098ce7 100644 --- a/Makefile +++ b/Makefile @@ -176,6 +176,8 @@ $(COMMON_CONSTRAINTS_TXT): upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: $(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 install -qr requirements/pip_tools.txt ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in 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 diff --git a/analytics_dashboard/settings/base.py b/analytics_dashboard/settings/base.py index ebb067719..6b4602280 100644 --- a/analytics_dashboard/settings/base.py +++ b/analytics_dashboard/settings/base.py @@ -84,6 +84,9 @@ # See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz USE_TZ = True +# Keep using deprecated pytz with Django>4.2 +USE_DEPRECATED_PYTZ = True + FORMAT_MODULE_PATH = 'core.formats' ########## END GENERAL CONFIGURATION diff --git a/requirements/base.txt b/requirements/base.txt index d85a55adf..0d5d006cd 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -10,6 +10,8 @@ asgiref==3.7.2 # via # django # django-countries +backports-zoneinfo==0.2.1 + # via django certifi==2023.7.22 # via requests cffi==1.16.0 @@ -32,9 +34,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-appconf @@ -170,9 +171,7 @@ python-slugify==8.0.1 python3-openid==3.2.0 # via social-auth-core pytz==2023.3.post1 - # via - # django - # djangorestframework + # via djangorestframework pyyaml==6.0.1 # via # code-annotations diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index afe6aa887..c84245937 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -13,7 +13,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 6ffa252d1..3bd16e635 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -13,8 +13,8 @@ # Newer version of django-webpack-loader is not compatible with npm webpack-bundle-tracker > 0.4.3 django-webpack-loader==0.7.0 -# Constraint Django to 3.2 LTS -django<3.3 +# Constraint Django to 4.2 LTS +django<4.3 # urllib3 > 2.0.2 introduces an error urllib3>=1.26.15, <2 diff --git a/requirements/django.txt b/requirements/django.txt index 5a28da341..7ac6d4fcc 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==3.2.22 +django==4.2.6 diff --git a/requirements/django42.txt b/requirements/django42.txt deleted file mode 100644 index 804f9e154..000000000 --- a/requirements/django42.txt +++ /dev/null @@ -1 +0,0 @@ -Django>=4.2,<4.3 diff --git a/requirements/doc.txt b/requirements/doc.txt index 2dd760c91..2ffa9c004 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -19,6 +19,10 @@ babel==2.13.0 # via # pydata-sphinx-theme # sphinx +backports-zoneinfo==0.2.1 + # via + # -r requirements/base.txt + # django beautifulsoup4==4.12.2 # via pydata-sphinx-theme certifi==2023.7.22 @@ -53,9 +57,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-appconf @@ -244,7 +247,6 @@ pytz==2023.3.post1 # via # -r requirements/base.txt # babel - # django # djangorestframework pyyaml==6.0.1 # via diff --git a/requirements/local.txt b/requirements/local.txt index 7dad3f593..bd59ac521 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -16,6 +16,10 @@ astroid==2.15.8 # -r requirements/test.txt # pylint # pylint-celery +backports-zoneinfo==0.2.1 + # via + # -r requirements/test.txt + # django bok-choy==2.0.2 # via -r requirements/test.txt build==1.0.3 @@ -77,9 +81,8 @@ distlib==0.3.7 # via # -r requirements/tox.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-appconf @@ -354,7 +357,6 @@ python3-openid==3.2.0 pytz==2023.3.post1 # via # -r requirements/test.txt - # django # djangorestframework pyyaml==6.0.1 # via diff --git a/requirements/production.txt b/requirements/production.txt index efb39fc46..4846745ba 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -11,6 +11,10 @@ asgiref==3.7.2 # -r requirements/base.txt # django # django-countries +backports-zoneinfo==0.2.1 + # via + # -r requirements/base.txt + # django certifi==2023.7.22 # via # -r requirements/base.txt @@ -43,9 +47,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-appconf @@ -225,7 +228,6 @@ python3-openid==3.2.0 pytz==2023.3.post1 # via # -r requirements/base.txt - # django # djangorestframework pyyaml==6.0.1 # via diff --git a/requirements/test.txt b/requirements/test.txt index 7eea9c8cb..0885e7f29 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -16,6 +16,10 @@ astroid==2.15.8 # -r requirements/test.in # pylint # pylint-celery +backports-zoneinfo==0.2.1 + # via + # -r requirements/base.txt + # django bok-choy==2.0.2 # via -r requirements/test.in certifi==2023.7.22 @@ -64,7 +68,6 @@ defusedxml==0.8.0rc2 dill==0.3.7 # via pylint # via - # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.txt # django-appconf @@ -284,7 +287,6 @@ python3-openid==3.2.0 pytz==2023.3.post1 # via # -r requirements/base.txt - # django # djangorestframework pyyaml==6.0.1 # via diff --git a/tox.ini b/tox.ini index 0c50111cc..6b7b6475a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38-django{32, 42} +envlist = py38-django{42} skipsdist = true [pytest] @@ -22,8 +22,7 @@ passenv = SELENIUM_BROWSER BOKCHOY_HEADLESS deps = - django32: -r requirements/django.txt - django42: -r requirements/django42.txt + django42: -r requirements/django.txt -r {toxinidir}/requirements/test.txt allowlist_externals = make