Skip to content

Commit

Permalink
Revert "feat: upgrade to Django 4.2 (openedx#4088)"
Browse files Browse the repository at this point in the history
This reverts commit 3c075d4.
  • Loading branch information
awais786 authored Oct 16, 2023
1 parent 3c075d4 commit 5bcdce5
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 24 deletions.
9 changes: 9 additions & 0 deletions .ci/docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
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: "password"
MYSQL_DATABASE: "discovery"

mysql80:
image: mysql:8.0
container_name: mysql80
Expand Down Expand Up @@ -42,6 +50,7 @@ services:
- ../course_discovery/assets:/edx/var/discovery/staticfiles
command: tail -f /dev/null
depends_on:
- "mysql57"
- "mysql80"
- "es"
- "memcached"
Expand Down
8 changes: 6 additions & 2 deletions .ci/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -e

apt-get update
apt-get install -y --no-install-recommends firefox gettext
make requirements

if [ "$TOXENV" == "py38-django42" ]
then
make requirements_dj42
else
make requirements
fi
make test
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
fail-fast: false
matrix:
python-version: ['py38']
django-version: ['django42']
db-version: ['mysql80']
django-version: ['django32', 'django42']
db-version: ['mysql57', 'mysql80']
pytest-split-group: [1, 2, 3, 4, 5, 6]
status: ['']
exclude:
- django-version: "django42"
db-version: "mysql57"

steps:
- uses: actions/checkout@v3
Expand All @@ -29,7 +32,7 @@ jobs:
# See https://github.com/actions/toolkit/issues/399
continue-on-error: ${{ matrix.status == 'ignored' }}
- name: Upload coverage
if: matrix.db-version == 'mysql80'
if: matrix.db-version == 'mysql57' # TODO: Remove this condition when removing 'mysql57' db-version.
uses: actions/upload-artifact@v2
with:
name: coverage${{ matrix.pytest-split-group }}
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ requirements.python: ## Install Python requirements for local development.

requirements: requirements.js requirements.python ## Install Python and JS requirements for local development

requirements.python_dj42: ## Install Python requirements for Django 4.2 env
pip install -r requirements/local.txt -r requirements/django42.txt

requirements_dj42: requirements.js requirements.python_dj42 ## Install Python and JS requirements for Django 4.2 env

production-requirements: ## Install Python and JS requirements for production
pip install -r requirements.txt
npm install --production
Expand All @@ -55,8 +60,6 @@ $(COMMON_CONSTRAINTS_TXT):
upgrade: $(COMMON_CONSTRAINTS_TXT)
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 install -q -r requirements/pip_tools.txt
pip-compile --allow-unsafe --upgrade -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip_tools.txt requirements/pip_tools.in
Expand All @@ -69,6 +72,9 @@ upgrade: $(COMMON_CONSTRAINTS_TXT)
grep -e "^django==" requirements/local.txt > requirements/django.txt
sed -i.tmp '/^[dD]jango==/d' requirements/local.txt
rm -rf requirements/local.txt.tmp
grep -e "^django-admin-sortable2==" requirements/local.txt >> requirements/django.txt
sed -i.tmp "/^django-admin-sortable2==/d" requirements/local.txt
rm -rf requirements/local.txt.tmp
chmod a+rw requirements/*.txt

test: clean ## Run tests and generate coverage report
Expand Down
2 changes: 0 additions & 2 deletions course_discovery/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,5 +773,3 @@
SIMPLE_HISTORY_DATE_INDEX = False

CSRF_TRUSTED_ORIGINS_WITH_SCHEME = [] # just for Django 4.2 upgrade

USE_DEPRECATED_PYTZ = True
2 changes: 1 addition & 1 deletion requirements/common_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Stay on an LTS release
django<4.0

# We are creating a local copy of the common constraints file and override/remove the global constraint which we don't need.
# This approach is used temporarily and will be improved in https://openedx.atlassian.net/browse/BOM-2721
# This file contains all common constraints for edx-repos
-c common_constraints.txt

# Stay on an LTS release
django<4.3

# Elasticsearch upgrades need to be done in lockstep across Open edX
elasticsearch>=7.8,<7.14
elasticsearch-dsl>=7.2,<8.0
Expand All @@ -23,6 +23,9 @@ algoliasearch<2.0.0
# Remove this pin once newer stable version is released
authlib==1.0.0rc1

# The latest version require Django 4.0, remove once we have upgraded to Django 4.0
django-admin-sortable2<2.0.0

# The latest versions of django-stdimage has breaking changes
# Remove this pin after fixing them.
django-stdimage<=5.3.0
Expand Down
3 changes: 2 additions & 1 deletion requirements/django.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
django==4.2.6
django==3.2.22
django-admin-sortable2==1.0.4
2 changes: 2 additions & 0 deletions requirements/django42.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
django==4.2.5
django-admin-sortable2==2.1.9
8 changes: 5 additions & 3 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# celery
# django
# kombu
bcrypt==4.0.1
# via paramiko
Expand Down Expand Up @@ -172,6 +171,7 @@ distlib==0.3.7
distro==1.8.0
# via docker-compose
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
# -r requirements/base.in
# algoliasearch-django
Expand Down Expand Up @@ -218,8 +218,9 @@ distro==1.8.0
# social-auth-app-django
# taxonomy-connector
# xss-utils
django-admin-sortable2==2.1.10
# via -r requirements/base.in
# via
# -c requirements/constraints.txt
# -r requirements/base.in
django-appconf==1.0.5
# via django-compressor
django-autocomplete-light==3.9.7
Expand Down Expand Up @@ -736,6 +737,7 @@ pytz==2023.3.post1
# via
# -r requirements/base.in
# babel
# django
# django-ses
# djangorestframework
# drf-yasg
Expand Down
11 changes: 7 additions & 4 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# celery
# django
# kombu
beautifulsoup4==4.12.2
# via
Expand Down Expand Up @@ -118,8 +117,9 @@ defusedxml==0.7.1
# djangorestframework-xml
# python3-openid
# social-auth-core
django==4.2.6
django==3.2.22
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
# -r requirements/base.in
# algoliasearch-django
Expand Down Expand Up @@ -164,8 +164,10 @@ django==4.2.6
# social-auth-app-django
# taxonomy-connector
# xss-utils
django-admin-sortable2==2.1.10
# via -r requirements/base.in
django-admin-sortable2==1.0.4
# via
# -c requirements/constraints.txt
# -r requirements/base.in
django-appconf==1.0.5
# via django-compressor
django-autocomplete-light==3.9.7
Expand Down Expand Up @@ -543,6 +545,7 @@ python3-openid==3.2.0
pytz==2023.3.post1
# via
# -r requirements/base.in
# django
# django-ses
# djangorestframework
# drf-yasg
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38-django{42}
envlist = py38-django{32, 42}
skipsdist=true

[pytest]
Expand All @@ -8,7 +8,8 @@ testpaths = course_discovery/apps

[testenv]
deps =
django42: -r requirements/django.txt
django32: -r requirements/django.txt
django42: -r requirements/django42.txt
-r{toxinidir}/requirements/local.txt
passenv =
CONN_MAX_AGE
Expand All @@ -23,7 +24,8 @@ passenv =
DB_ENGINE
CACHE_BACKEND
PYTEST_SPLIT_GROUP
allowlist_externals =

whitelist_externals =
make
commands =
make clean static
Expand Down

0 comments on commit 5bcdce5

Please sign in to comment.