From aee13beb9c0cedf608b0f483af36b00a6139e225 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Tue, 8 Aug 2023 15:30:33 +0500 Subject: [PATCH] chore: Upgrading django-simple-history. (#140) * chore: Upgrading django-simple-history. * docs: bump release version to 2.3.6 --------- Co-authored-by: Usama Sadiq --- CHANGELOG.rst | 4 +++ Makefile | 15 ++++++++-- edx_name_affirmation/__init__.py | 2 +- ...08_alter_historicalverifiedname_options.py | 17 +++++++++++ requirements/base.txt | 6 ++-- requirements/celery44.in | 1 - requirements/celery44.txt | 20 ------------- requirements/{celery50.in => celery53.in} | 0 requirements/{celery50.txt => celery53.txt} | 2 +- requirements/ci.txt | 2 +- requirements/common_constraints.txt | 28 +++++++++++++++++ requirements/constraints.txt | 5 +++- requirements/dev.txt | 25 ++-------------- requirements/doc.txt | 6 ++-- requirements/quality.txt | 14 +-------- requirements/test.txt | 6 ++-- test_settings.py | 4 +++ tox.ini | 30 +++++++++---------- 18 files changed, 99 insertions(+), 88 deletions(-) create mode 100644 edx_name_affirmation/migrations/0008_alter_historicalverifiedname_options.py delete mode 100644 requirements/celery44.in delete mode 100644 requirements/celery44.txt rename requirements/{celery50.in => celery53.in} (100%) rename requirements/{celery50.txt => celery53.txt} (95%) create mode 100644 requirements/common_constraints.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ab7166a..5629044 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,10 @@ Change Log Unreleased ~~~~~~~~~~ +[2.3.6] - 2023-07-28 +~~~~~~~~~~~~~~~~~~~~ +* Upgrade django-simple-history. Added new migration. Fixed packages upgrade issues. + [2.3.5] - 2022-09-09 ~~~~~~~~~~~~~~~~~~~~ * Fix bug that prevents a verified name from being updated if the user already has an approved verified name associated with a proctored exam attempt diff --git a/Makefile b/Makefile index 2ce895d..3c68c78 100644 --- a/Makefile +++ b/Makefile @@ -29,13 +29,23 @@ docs: ## generate Sphinx HTML documentation, including API docs tox -e docs $(BROWSER)docs/_build/html/index.html + # Define PIP_COMPILE_OPTS=-v to get more information during make upgrade. PIP_COMPILE = pip-compile --rebuild --upgrade $(PIP_COMPILE_OPTS) +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: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in +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 pip install -qr requirements/pip-tools.txt # Make sure to compile files after any other files they include! + # need to do this to remove django-simple-history from common constraint. $(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in $(PIP_COMPILE) -o requirements/base.txt requirements/base.in $(PIP_COMPILE) -o requirements/test.txt requirements/test.in @@ -43,8 +53,7 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy $(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in $(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in $(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in - $(PIP_COMPILE) -o requirements/celery44.txt requirements/celery44.in - $(PIP_COMPILE) -o requirements/celery50.txt requirements/celery50.in + $(PIP_COMPILE) -o requirements/celery53.txt requirements/celery53.in # Let tox control the Django version for tests sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp mv requirements/test.tmp requirements/test.txt diff --git a/edx_name_affirmation/__init__.py b/edx_name_affirmation/__init__.py index 0fee05f..60f5cf0 100644 --- a/edx_name_affirmation/__init__.py +++ b/edx_name_affirmation/__init__.py @@ -2,6 +2,6 @@ Django app housing name affirmation logic. """ -__version__ = '2.3.5' +__version__ = '2.3.6' default_app_config = 'edx_name_affirmation.apps.EdxNameAffirmationConfig' # pylint: disable=invalid-name diff --git a/edx_name_affirmation/migrations/0008_alter_historicalverifiedname_options.py b/edx_name_affirmation/migrations/0008_alter_historicalverifiedname_options.py new file mode 100644 index 0000000..4826815 --- /dev/null +++ b/edx_name_affirmation/migrations/0008_alter_historicalverifiedname_options.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.20 on 2023-07-28 13:57 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('edx_name_affirmation', '0007_historicalverifiedname'), + ] + + operations = [ + migrations.AlterModelOptions( + name='historicalverifiedname', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical verified name', 'verbose_name_plural': 'historical verified names'}, + ), + ] diff --git a/requirements/base.txt b/requirements/base.txt index ddda6f4..eb18b82 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -46,7 +46,7 @@ cryptography==41.0.2 # via pyjwt django==3.2.20 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -r requirements/base.in # django-config-models # django-crum @@ -71,9 +71,9 @@ django-model-utils==4.3.1 # via # -r requirements/base.in # edx-celeryutils -django-simple-history==3.0.0 +django-simple-history==3.1.1 # 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-waffle==4.0.0 # via diff --git a/requirements/celery44.in b/requirements/celery44.in deleted file mode 100644 index 033b967..0000000 --- a/requirements/celery44.in +++ /dev/null @@ -1 +0,0 @@ -celery>=4.4,<4.5 diff --git a/requirements/celery44.txt b/requirements/celery44.txt deleted file mode 100644 index 33db209..0000000 --- a/requirements/celery44.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: -# -# make upgrade -# -amqp==2.6.1 - # via kombu -billiard==3.6.4.0 - # via celery -celery==4.4.7 - # via -r requirements/celery44.in -kombu==4.6.11 - # via celery -pytz==2023.3 - # via celery -vine==1.3.0 - # via - # amqp - # celery diff --git a/requirements/celery50.in b/requirements/celery53.in similarity index 100% rename from requirements/celery50.in rename to requirements/celery53.in diff --git a/requirements/celery50.txt b/requirements/celery53.txt similarity index 95% rename from requirements/celery50.txt rename to requirements/celery53.txt index 3f1f6bd..588a077 100644 --- a/requirements/celery50.txt +++ b/requirements/celery53.txt @@ -13,7 +13,7 @@ backports-zoneinfo[tzdata]==0.2.1 billiard==4.1.0 # via celery celery==5.3.1 - # via -r requirements/celery50.in + # via -r requirements/celery53.in click==8.1.6 # via # celery diff --git a/requirements/ci.txt b/requirements/ci.txt index b43d9e2..f9cb189 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -24,7 +24,7 @@ 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/ci.in # tox-battery tox-battery==0.6.1 diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt new file mode 100644 index 0000000..5a86f01 --- /dev/null +++ b/requirements/common_constraints.txt @@ -0,0 +1,28 @@ + +# 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 +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 +elasticsearch<7.14.0 + +# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected + + +# 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 f91fa8c..bd700b5 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -9,7 +9,10 @@ # linking to it here is good. # Common constraints for edx repos --c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt +-c common_constraints.txt # pinning celery to latest release celery<6.0 + +# incremental upgrade plan. +django-simple-history<=3.1.1 diff --git a/requirements/dev.txt b/requirements/dev.txt index df03d89..354c8fa 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -25,10 +25,6 @@ certifi==2023.7.22 # via # -r requirements/quality.txt # requests -cffi==1.15.1 - # via - # -r requirements/quality.txt - # cryptography chardet==5.1.0 # via diff-cover charset-normalizer==3.2.0 @@ -60,10 +56,6 @@ commonmark==0.9.1 # via # -r requirements/quality.txt # rich -cryptography==41.0.2 - # via - # -r requirements/quality.txt - # secretstorage diff-cover==7.7.0 # via -r requirements/dev.in dill==0.3.7 @@ -76,7 +68,7 @@ distlib==0.3.7 # virtualenv django==3.2.20 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -r requirements/quality.txt # edx-i18n-tools docutils==0.19 @@ -114,11 +106,6 @@ jaraco-classes==3.3.0 # via # -r requirements/quality.txt # keyring -jeepney==0.8.0 - # via - # -r requirements/quality.txt - # keyring - # secretstorage jinja2==3.1.2 # via # -r requirements/quality.txt @@ -181,10 +168,6 @@ py==1.11.0 # tox pycodestyle==2.11.0 # via -r requirements/quality.txt -pycparser==2.21 - # via - # -r requirements/quality.txt - # cffi pydantic==1.10.12 # via # -r requirements/quality.txt @@ -262,10 +245,6 @@ rstcheck-core==1.0.3 # via # -r requirements/quality.txt # rstcheck -secretstorage==3.3.3 - # via - # -r requirements/quality.txt - # keyring shellingham==1.5.0.post1 # via # -r requirements/quality.txt @@ -309,7 +288,7 @@ tomlkit==0.12.1 # pylint 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/ci.txt # tox-battery tox-battery==0.6.1 diff --git a/requirements/doc.txt b/requirements/doc.txt index 47a0da3..35aab56 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -52,7 +52,7 @@ cryptography==41.0.2 # via pyjwt django==3.2.20 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -r requirements/base.in # django-config-models # django-crum @@ -77,9 +77,9 @@ django-model-utils==4.3.1 # via # -r requirements/base.in # edx-celeryutils -django-simple-history==3.0.0 +django-simple-history==3.1.1 # 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-waffle==4.0.0 # via diff --git a/requirements/quality.txt b/requirements/quality.txt index 92972e1..01869ae 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -14,8 +14,6 @@ bleach==6.0.0 # via readme-renderer certifi==2023.7.22 # via requests -cffi==1.15.1 - # via cryptography charset-normalizer==3.2.0 # via requests click==8.1.6 @@ -32,13 +30,11 @@ colorama==0.4.6 # via typer commonmark==0.9.1 # via rich -cryptography==41.0.2 - # via secretstorage dill==0.3.7 # via pylint django==3.2.20 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -r requirements/quality.in docutils==0.19 # via @@ -60,10 +56,6 @@ isort==5.12.0 # pylint jaraco-classes==3.3.0 # via keyring -jeepney==0.8.0 - # via - # keyring - # secretstorage jinja2==3.1.2 # via code-annotations keyring==24.2.0 @@ -84,8 +76,6 @@ platformdirs==3.10.0 # via pylint pycodestyle==2.11.0 # via -r requirements/quality.in -pycparser==2.21 - # via cffi pydantic==1.10.12 # via rstcheck-core pydocstyle==6.3.0 @@ -132,8 +122,6 @@ rstcheck==6.1.2 # via -r requirements/quality.in rstcheck-core==1.0.3 # via rstcheck -secretstorage==3.3.3 - # via keyring shellingham==1.5.0.post1 # via typer six==1.16.0 diff --git a/requirements/test.txt b/requirements/test.txt index f283cc1..f01e3ec 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -71,7 +71,7 @@ cryptography==41.0.2 ddt==1.6.0 # via -r requirements/test.in # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c requirements/common_constraints.txt # -r requirements/base.txt # django-config-models # django-crum @@ -97,9 +97,9 @@ django-model-utils==4.3.1 # via # -r requirements/base.txt # edx-celeryutils -django-simple-history==3.0.0 +django-simple-history==3.1.1 # 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-waffle==4.0.0 # via diff --git a/test_settings.py b/test_settings.py index 6e9b05c..a67ba25 100644 --- a/test_settings.py +++ b/test_settings.py @@ -72,3 +72,7 @@ def root(*args): ], }, }] + + +# disable indexing on history_date +SIMPLE_HISTORY_DATE_INDEX = False diff --git a/tox.ini b/tox.ini index bdb7878..bf70ef0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38-django{32,40}-celery{44,50}, quality, rst_validation, docs, pii_check +envlist = py38-django{32,40}-celery{53}, quality, rst_validation, docs, pii_check [doc8] ignore = D001 @@ -34,34 +34,34 @@ addopts = --cov edx_name_affirmation --cov-report term-missing --cov-report xml norecursedirs = .* docs requirements site-packages [testenv] -deps = +deps = django32: Django>=3.2,<4.0 django40: Django>=4.0,<4.1 -r{toxinidir}/requirements/test.txt celery44: -r{toxinidir}/requirements/celery44.txt celery50: -r{toxinidir}/requirements/celery50.txt -commands = +commands = python manage.py check pytest {posargs} [testenv:rst_validation] -whitelist_externals = +whitelist_externals = make -deps = +deps = -r{toxinidir}/requirements/quality.txt -commands = +commands = make quality-rst [testenv:docs] -setenv = +setenv = DJANGO_SETTINGS_MODULE = test_settings PYTHONPATH = {toxinidir} -whitelist_externals = +whitelist_externals = make rm -deps = +deps = -r{toxinidir}/requirements/doc.txt -commands = +commands = doc8 --ignore-path docs/_build README.rst docs rm -f docs/edx_name_affirmation.rst rm -f docs/modules.rst @@ -70,19 +70,19 @@ commands = python setup.py check --restructuredtext --strict [testenv:quality] -deps = +deps = -r{toxinidir}/requirements/quality.txt -r{toxinidir}/requirements/test.txt -commands = +commands = pylint edx_name_affirmation pycodestyle edx_name_affirmation isort --check-only --diff edx_name_affirmation manage.py setup.py [testenv:pii_check] -setenv = +setenv = DJANGO_SETTINGS_MODULE = test_settings -deps = +deps = -r{toxinidir}/requirements/quality.txt -commands = +commands = code_annotations django_find_annotations --config_file .pii_annotations.yml --lint --report --coverage