diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b88e855b..9ae74dd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,20 +14,15 @@ jobs: max-parallel: 4 matrix: python-version: ['py38'] - 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' + django-version: ['django42'] + db-version: ['mysql80'] steps: - uses: actions/checkout@v2 - name: Start container run: | docker-compose -f .travis/docker-compose-travis.yml up -d - - name: Install Dependencies + - name: Install system packages 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 26eb6c5c..2a043599 100644 --- a/.travis/docker-compose-travis.yml +++ b/.travis/docker-compose-travis.yml @@ -1,16 +1,6 @@ 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 @@ -49,7 +39,6 @@ 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 31b6973c..98193f79 100644 --- a/Makefile +++ b/Makefile @@ -65,9 +65,23 @@ 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 ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in +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 # 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 @@ -76,6 +90,4 @@ upgrade: piptools ## update the requirements/*.txt files with the latest package 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 '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp - mv requirements/test.tmp requirements/test.txt - + sed -i.'' '/^[dD]jango==/d' requirements/test.txt diff --git a/requirements/base.txt b/requirements/base.txt index 6bd9d75f..f0a0358f 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -6,6 +6,8 @@ # asgiref==3.7.2 # via django +backports-zoneinfo==0.2.1 + # via django certifi==2023.7.22 # via # elasticsearch @@ -18,11 +20,11 @@ chardet==3.0.4 # via requests click==8.1.7 # via edx-django-utils -cryptography==41.0.4 +cryptography==41.0.5 # via pyjwt -django==3.2.22 +django==4.2.6 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/constraints.txt # -r requirements/base.in # django-cors-headers # django-crum @@ -34,10 +36,8 @@ django==3.2.22 # edx-django-release-util # edx-django-utils # edx-drf-extensions -django-cors-headers==3.14.0 - # via - # -c requirements/constraints.txt - # -r requirements/base.in +django-cors-headers==4.3.0 + # via -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 https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.in # django-elasticsearch-dsl-drf @@ -131,7 +131,6 @@ 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 new file mode 100644 index 00000000..0091b9ec --- /dev/null +++ b/requirements/common_constraints.txt @@ -0,0 +1,32 @@ +# 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 fa7b0411..8e6e2204 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,8 +8,11 @@ # pin when possible. Writing an issue against the offending project and # linking to it here is good. -# This file contains all common constraints for edx-repos --c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt +-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 astroid==1.6.6 requests==2.25.0 @@ -21,4 +24,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 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/pip.txt b/requirements/pip.txt index 2154d29f..0c788d61 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 +pip==23.3.1 # 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 89d8bced..408d80c3 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -13,6 +13,10 @@ 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 @@ -41,7 +45,7 @@ coverage[toml]==7.3.2 # via # -r requirements/test.in # pytest-cov -cryptography==41.0.4 +cryptography==41.0.5 # via # -r requirements/base.txt # pyjwt @@ -52,7 +56,7 @@ diff-cover==7.7.0 distlib==0.3.7 # via virtualenv # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/constraints.txt # -r requirements/base.txt # django-cors-headers # django-crum @@ -64,10 +68,8 @@ distlib==0.3.7 # edx-django-release-util # edx-django-utils # edx-drf-extensions -django-cors-headers==3.14.0 - # via - # -c requirements/constraints.txt - # -r requirements/base.txt +django-cors-headers==4.3.0 + # via -r requirements/base.txt django-crum==0.7.9 # via # -r requirements/base.txt @@ -115,7 +117,7 @@ edx-opaque-keys==2.5.1 # edx-drf-extensions elasticsearch==7.13.4 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -c requirements/constraints.txt # -r requirements/base.txt # django-elasticsearch-dsl-drf @@ -130,7 +132,7 @@ exceptiongroup==1.1.3 # via pytest factory-boy==3.3.0 # via -r requirements/test.in -faker==19.11.0 +faker==19.12.0 # via factory-boy filelock==3.12.4 # via @@ -222,7 +224,7 @@ pynacl==1.5.0 # via # -r requirements/base.txt # edx-django-utils -pytest==7.4.2 +pytest==7.4.3 # via # -r requirements/test.in # pytest-cov @@ -242,7 +244,6 @@ python-slugify==8.0.1 pytz==2023.3.post1 # via # -r requirements/base.txt - # django # djangorestframework # drf-yasg pyyaml==6.0.1 @@ -291,7 +292,7 @@ tomli==2.0.1 # tox tox==3.28.0 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -r requirements/test.in typing-extensions==4.8.0 # via @@ -308,7 +309,7 @@ urllib3==1.26.18 # -r requirements/base.txt # elasticsearch # requests -virtualenv==20.24.5 +virtualenv==20.24.6 # via tox wrapt==1.15.0 # via astroid diff --git a/requirements/travis.txt b/requirements/travis.txt index c4b2a642..ae825c48 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 https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -r requirements/travis.in # tox-battery tox-battery==0.6.2 # via -r requirements/travis.in -virtualenv==20.24.5 +virtualenv==20.24.6 # via tox diff --git a/tox.ini b/tox.ini index 193a8372..1809ae17 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,9 @@ [tox] -envlist = py38-django{32, 42} +envlist = py38-django{42} skipsdist = true [testenv] deps = - django32: Django>=3.2,<4.0 django42: Django>=4.2,<4.3 -r {toxinidir}/requirements/test.txt passenv =