From c65a7e63a691e8ad69558b16c957d74db34a20f8 Mon Sep 17 00:00:00 2001 From: zubairshakoorarbisoft Date: Tue, 26 Sep 2023 22:32:58 +0500 Subject: [PATCH] feat!: upgrade to django42 --- .github/workflows/ci.yml | 2 +- Makefile | 6 ++++++ edx_exams/settings/base.py | 5 +++++ requirements/constraints.txt | 3 +++ tox.ini | 3 +-- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32ca4d49..f30f5821 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: matrix: os: [ubuntu-20.04] python-version: ['3.8'] - toxenv: [django32, django42, quality, pii_check] + toxenv: [django42, quality, pii_check] steps: - uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index 6b17a108..6a68e8e2 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,10 @@ migrate: ## apply database migrations html_coverage: ## generate and view HTML coverage report coverage html && open htmlcov/index.html +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): @@ -108,6 +112,8 @@ upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in 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 # Make sure to compile files after any other files they include! pip-compile --upgrade --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in diff --git a/edx_exams/settings/base.py b/edx_exams/settings/base.py index 1b12ce02..92a580d7 100644 --- a/edx_exams/settings/base.py +++ b/edx_exams/settings/base.py @@ -130,6 +130,11 @@ def root(*path_fragments): USE_TZ = True +# 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 + LOCALE_PATHS = ( root('conf', 'locale'), ) diff --git a/requirements/constraints.txt b/requirements/constraints.txt index a51cb08b..501fac1b 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -10,3 +10,6 @@ # Common constraints for edx repos -c common_constraints.txt + +# Stay on LTS +Django<5.0 diff --git a/tox.ini b/tox.ini index 1d0e6eb4..2be151a7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38-django{32,42}, quality, docs, pii_check +envlist = py38-django{42}, quality, docs, pii_check skipsdist = true [doc8] @@ -43,7 +43,6 @@ filterwarnings = [testenv] deps = - django32: Django>=3.2,<4.0 django42: Django>=4.2,<4.3 -r{toxinidir}/requirements/test.txt commands =