From 5c7519630495c0cffcd0d707fbeea243f060b205 Mon Sep 17 00:00:00 2001 From: Muhammad Soban Javed <58461728+iamsobanjaved@users.noreply.github.com> Date: Thu, 2 Nov 2023 01:35:17 +0500 Subject: [PATCH] Revert "feat!: upgrade to Django 4.2 LTS (#357)" This reverts commit ae4ea9ec17125f9ba773d5c3c4b8c5f5a1516200. --- .github/workflows/ci.yml | 11 +++++++--- .travis/docker-compose-travis.yml | 11 ++++++++++ Makefile | 20 ++++-------------- requirements/base.txt | 17 +++++++-------- requirements/common_constraints.txt | 32 ----------------------------- requirements/constraints.txt | 11 ++++------ requirements/django.txt | 2 +- requirements/pip.txt | 2 +- requirements/test.txt | 25 +++++++++++----------- requirements/travis.txt | 4 ++-- tox.ini | 3 ++- 11 files changed, 54 insertions(+), 84 deletions(-) delete mode 100644 requirements/common_constraints.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ae74dd3..b88e855b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,15 +14,20 @@ jobs: max-parallel: 4 matrix: python-version: ['py38'] - django-version: ['django42'] - db-version: ['mysql80'] + 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' steps: - uses: actions/checkout@v2 - name: Start container run: | docker-compose -f .travis/docker-compose-travis.yml up -d - - name: Install system packages + - name: Install Dependencies run: | docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api \ /bin/bash -c "apt-get update && apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config" diff --git a/.travis/docker-compose-travis.yml b/.travis/docker-compose-travis.yml index 2a043599..26eb6c5c 100644 --- a/.travis/docker-compose-travis.yml +++ b/.travis/docker-compose-travis.yml @@ -1,6 +1,16 @@ 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 @@ -39,6 +49,7 @@ 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 98193f79..31b6973c 100644 --- a/Makefile +++ b/Makefile @@ -65,23 +65,9 @@ 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 $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in - # This is a temporary solution to override the real common_constraints.txt - # In edx-lint, until the pyjwt constraint in edx-lint has been removed. - # See BOM-271 for more details. - sed -i.'' 's/Django<4.0//g' requirements/common_constraints.txt +upgrade: piptools ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in # Make sure to compile files after any other files they include! - pip-compile --upgrade -o requirements/travis.txt requirements/travis.in 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 @@ -90,4 +76,6 @@ upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt fi pip-compile --upgrade -o requirements/test.txt requirements/test.in # Let tox control the Django version for tests grep -e "^django==" requirements/base.txt > requirements/django.txt - sed -i.'' '/^[dD]jango==/d' requirements/test.txt + sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp + mv requirements/test.tmp requirements/test.txt + diff --git a/requirements/base.txt b/requirements/base.txt index f0a0358f..6bd9d75f 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -6,8 +6,6 @@ # asgiref==3.7.2 # via django -backports-zoneinfo==0.2.1 - # via django certifi==2023.7.22 # via # elasticsearch @@ -20,11 +18,11 @@ chardet==3.0.4 # via requests click==8.1.7 # via edx-django-utils -cryptography==41.0.5 +cryptography==41.0.4 # via pyjwt -django==4.2.6 +django==3.2.22 # via - # -c requirements/constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.in # django-cors-headers # django-crum @@ -36,8 +34,10 @@ django==4.2.6 # edx-django-release-util # edx-django-utils # edx-drf-extensions -django-cors-headers==4.3.0 - # via -r requirements/base.in +django-cors-headers==3.14.0 + # via + # -c requirements/constraints.txt + # -r requirements/base.in django-crum==0.7.9 # via edx-django-utils django-elasticsearch-dsl==7.4 @@ -76,7 +76,7 @@ edx-opaque-keys==2.5.1 # via edx-drf-extensions elasticsearch==7.13.4 # via - # -c requirements/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.in # django-elasticsearch-dsl-drf @@ -131,6 +131,7 @@ python-dateutil==2.4.0 # elasticsearch-dsl pytz==2023.3.post1 # via + # django # djangorestframework # drf-yasg pyyaml==6.0.1 diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt deleted file mode 100644 index 0091b9ec..00000000 --- a/requirements/common_constraints.txt +++ /dev/null @@ -1,32 +0,0 @@ -# This is a temporary solution to override the real common_constraints.txt -# In edx-lint, until the pyjwt constraint in edx-lint has been removed. -# See BOM-2721 for more details. -# Below is the copied and edited version of common_constraints - -# A central location for most common version constraints -# (across edx repos) for pip-installation. -# -# Similar to other constraint files this file doesn't install any packages. -# It specifies version constraints that will be applied if a package is needed. -# When pinning something here, please provide an explanation of why it is a good -# idea to pin this package across all edx repos, Ideally, link to other information -# that will help people in the future to remove the pin when possible. -# Writing an issue against the offending project and linking to it here is good. -# -# Note: Changes to this file will automatically be used by other repos, referencing -# this file from Github directly. It does not require packaging in edx-lint. - - -# using LTS django version - - -# 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 -elasticsearch<7.14.0 - -# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected -django-simple-history==3.0.0 - -# tox>4.0.0 isn't yet compatible with many tox plugins, causing CI failures in almost all repos. -# Details can be found in this discussion: https://github.com/tox-dev/tox/discussions/1810 -tox<4.0.0 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 8e6e2204..fa7b0411 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -1,4 +1,4 @@ -# Version constraints for pip-installation. +# Version constraints for pip installation. # # This file doesn't install any packages. It specifies version constraints # that will be applied if a package is needed. @@ -8,11 +8,8 @@ # pin when possible. Writing an issue against the offending project and # linking to it here is good. --c common_constraints.txt - -# Keeping Django to latest Django 4.2 LTS -# This constraint can be removed once the global constraint has been updated -Django<4.3 +# This file contains all common constraints for edx-repos +-c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt astroid==1.6.6 requests==2.25.0 @@ -24,4 +21,4 @@ python-dateutil==2.4.0 newrelic==4.8.0.110 more-itertools==5.0.0 pylint==1.5.0 - +django-cors-headers==3.14.0 diff --git a/requirements/django.txt b/requirements/django.txt index 7ac6d4fc..5a28da34 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==4.2.6 +django==3.2.22 diff --git a/requirements/pip.txt b/requirements/pip.txt index 0c788d61..2154d29f 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -8,7 +8,7 @@ wheel==0.41.2 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: -pip==23.3.1 +pip==23.3 # 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 408d80c3..89d8bced 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -13,10 +13,6 @@ astroid==1.6.6 # -c requirements/constraints.txt # -r requirements/test.in # pylint -backports-zoneinfo==0.2.1 - # via - # -r requirements/base.txt - # django certifi==2023.7.22 # via # -r requirements/base.txt @@ -45,7 +41,7 @@ coverage[toml]==7.3.2 # via # -r requirements/test.in # pytest-cov -cryptography==41.0.5 +cryptography==41.0.4 # via # -r requirements/base.txt # pyjwt @@ -56,7 +52,7 @@ diff-cover==7.7.0 distlib==0.3.7 # via virtualenv # via - # -c requirements/constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.txt # django-cors-headers # django-crum @@ -68,8 +64,10 @@ distlib==0.3.7 # edx-django-release-util # edx-django-utils # edx-drf-extensions -django-cors-headers==4.3.0 - # via -r requirements/base.txt +django-cors-headers==3.14.0 + # via + # -c requirements/constraints.txt + # -r requirements/base.txt django-crum==0.7.9 # via # -r requirements/base.txt @@ -117,7 +115,7 @@ edx-opaque-keys==2.5.1 # edx-drf-extensions elasticsearch==7.13.4 # via - # -c requirements/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.txt # django-elasticsearch-dsl-drf @@ -132,7 +130,7 @@ exceptiongroup==1.1.3 # via pytest factory-boy==3.3.0 # via -r requirements/test.in -faker==19.12.0 +faker==19.11.0 # via factory-boy filelock==3.12.4 # via @@ -224,7 +222,7 @@ pynacl==1.5.0 # via # -r requirements/base.txt # edx-django-utils -pytest==7.4.3 +pytest==7.4.2 # via # -r requirements/test.in # pytest-cov @@ -244,6 +242,7 @@ python-slugify==8.0.1 pytz==2023.3.post1 # via # -r requirements/base.txt + # django # djangorestframework # drf-yasg pyyaml==6.0.1 @@ -292,7 +291,7 @@ tomli==2.0.1 # tox tox==3.28.0 # via - # -c requirements/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/test.in typing-extensions==4.8.0 # via @@ -309,7 +308,7 @@ urllib3==1.26.18 # -r requirements/base.txt # elasticsearch # requests -virtualenv==20.24.6 +virtualenv==20.24.5 # via tox wrapt==1.15.0 # via astroid diff --git a/requirements/travis.txt b/requirements/travis.txt index ae825c48..c4b2a642 100644 --- a/requirements/travis.txt +++ b/requirements/travis.txt @@ -24,10 +24,10 @@ tomli==2.0.1 # via tox tox==3.28.0 # via - # -c requirements/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/travis.in # tox-battery tox-battery==0.6.2 # via -r requirements/travis.in -virtualenv==20.24.6 +virtualenv==20.24.5 # via tox diff --git a/tox.ini b/tox.ini index 1809ae17..193a8372 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,10 @@ [tox] -envlist = py38-django{42} +envlist = py38-django{32, 42} skipsdist = true [testenv] deps = + django32: Django>=3.2,<4.0 django42: Django>=4.2,<4.3 -r {toxinidir}/requirements/test.txt passenv =