From 8d3eedd88eb1a67614d3efa7b4dfc3eb85625ce7 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 08:54:57 +0100 Subject: [PATCH 1/8] Remove importlib-metadata from requirements file This was pinned in https://github.com/alphagov/notifications-admin/commit/ee3fb2f175724d304fba9b90aba24890c4de1147 to prevent version conflicts. It only seems to be required by packages when the version of Python is 3.8 or lower (e.g. https://github.com/PyCQA/flake8/blob/21d3c70d676007470908d39b73f0521d39b3b997/docs/source/release-notes/3.8.0.rst#new-dependency-information), so is now not required anyway. --- requirements.in | 1 - requirements.txt | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/requirements.in b/requirements.in index a37f6e989..9fdd227b3 100644 --- a/requirements.in +++ b/requirements.in @@ -23,7 +23,6 @@ git+https://github.com/benoitc/gunicorn.git@1299ea9e967a61ae2edebe191082fd169b86 notifications-python-client==6.3.0 rtreelib==0.2.0 fido2==0.9.3 -importlib-metadata==4.2.0 pyproj==3.2.1 # PaaS diff --git a/requirements.txt b/requirements.txt index 851242113..94328ad7c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.10 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile requirements.in @@ -87,8 +87,6 @@ humanize==4.0.0 # via -r requirements.in idna==2.10 # via requests -importlib-metadata==4.2.0 - # via -r requirements.in itsdangerous==1.1.0 # via # -r requirements.in @@ -121,7 +119,7 @@ mistune==0.8.4 # via notifications-utils notifications-python-client==6.3.0 # via -r requirements.in -notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.0 +notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.1 # via -r requirements.in openpyxl==3.0.7 # via pyexcel-xlsx @@ -229,8 +227,6 @@ xlrd==1.2.0 # via pyexcel-xls xlwt==1.3.0 # via pyexcel-xls -zipp==3.5.0 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # setuptools From 57f8a724c1d31920636acd59b88a88076c12b1eb Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 09:25:32 +0100 Subject: [PATCH 2/8] Update flask-wtf from 1.0.0 to 1.0.1 --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 9fdd227b3..f7b5232db 100644 --- a/requirements.in +++ b/requirements.in @@ -5,7 +5,7 @@ ago==0.0.93 govuk-bank-holidays==0.11 humanize==4.0.0 Flask==1.1.2 # pyup: <2 -Flask-WTF==1.0.0 +Flask-WTF==1.0.1 wtforms==3.0.1 Flask-Login==0.5.0 werkzeug==2.0.2 diff --git a/requirements.txt b/requirements.txt index 94328ad7c..1f586db98 100644 --- a/requirements.txt +++ b/requirements.txt @@ -67,7 +67,7 @@ flask-login==0.5.0 # via -r requirements.in flask-redis==0.4.0 # via notifications-utils -flask-wtf==1.0.0 +flask-wtf==1.0.1 # via -r requirements.in gds-metrics==0.2.4 # via -r requirements.in From 7e5e4b18a0861ac857bcbc9538e886d6924c24b7 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 09:29:37 +0100 Subject: [PATCH 3/8] Update flask-login from 0.5.0 to 0.6.0 --- requirements.in | 2 +- requirements.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index f7b5232db..9acb71fce 100644 --- a/requirements.in +++ b/requirements.in @@ -7,7 +7,7 @@ humanize==4.0.0 Flask==1.1.2 # pyup: <2 Flask-WTF==1.0.1 wtforms==3.0.1 -Flask-Login==0.5.0 +Flask-Login==0.6.0 werkzeug==2.0.2 jinja2==3.0.2 diff --git a/requirements.txt b/requirements.txt index 1f586db98..6aefd2981 100644 --- a/requirements.txt +++ b/requirements.txt @@ -63,7 +63,7 @@ flask==1.1.2 # flask-wtf # gds-metrics # notifications-utils -flask-login==0.5.0 +flask-login==0.6.0 # via -r requirements.in flask-redis==0.4.0 # via notifications-utils @@ -219,6 +219,7 @@ werkzeug==2.0.2 # via # -r requirements.in # flask + # flask-login wtforms==3.0.1 # via # -r requirements.in From 0feb37743a82ee54656a8b53b829de4c670a2fa4 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 09:37:27 +0100 Subject: [PATCH 4/8] Update pytz from 2021.3 to 2022.1 --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 9acb71fce..8d90a9873 100644 --- a/requirements.in +++ b/requirements.in @@ -17,7 +17,7 @@ pyexcel-io==0.6.6 pyexcel-xls==0.7.0 pyexcel-xlsx==0.6.0 pyexcel-ods3==0.6.0 -pytz==2021.3 +pytz==2022.1 # Should be pinned until a new gunicorn release greater than 20.1.0 comes out. (Due to eventlet v0.33 compatibility issues) git+https://github.com/benoitc/gunicorn.git@1299ea9e967a61ae2edebe191082fd169b864c64#egg=gunicorn[eventlet]==20.1.0 notifications-python-client==6.3.0 diff --git a/requirements.txt b/requirements.txt index 6aefd2981..932ed5113 100644 --- a/requirements.txt +++ b/requirements.txt @@ -170,7 +170,7 @@ python-dateutil==2.8.1 # botocore python-json-logger==2.0.1 # via notifications-utils -pytz==2021.3 +pytz==2022.1 # via # -r requirements.in # notifications-utils From 777f719185b260d9e00a34b0b9d373a5ce5c618a Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 10:30:53 +0100 Subject: [PATCH 5/8] Update pyexcel from 0.6.7 to 0.7.0 --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 8d90a9873..bf236e77b 100644 --- a/requirements.in +++ b/requirements.in @@ -12,7 +12,7 @@ werkzeug==2.0.2 jinja2==3.0.2 blinker==1.4 -pyexcel==0.6.7 +pyexcel==0.7.0 pyexcel-io==0.6.6 pyexcel-xls==0.7.0 pyexcel-xlsx==0.6.0 diff --git a/requirements.txt b/requirements.txt index 932ed5113..6897d8a2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -137,7 +137,7 @@ pyasn1==0.4.8 # via rsa pycparser==2.20 # via cffi -pyexcel==0.6.7 +pyexcel==0.7.0 # via -r requirements.in pyexcel-ezodf==0.3.4 # via pyexcel-ods3 From f3db221fcb275a8b03f8ff5fc09b032ebef5b2c9 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 12:05:54 +0100 Subject: [PATCH 6/8] Bump notifications-utils to 55.1.2 This brings in a change to allow pyproj to be updated. --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index bf236e77b..140114761 100644 --- a/requirements.in +++ b/requirements.in @@ -28,7 +28,7 @@ pyproj==3.2.1 # PaaS awscli-cwlogs>=1.4,<1.5 itsdangerous==1.1.0 # pyup: <2 -notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.1 +notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.2 govuk-frontend-jinja @ git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.8-alpha # gds-metrics requires prometheseus 0.2.0, override that requirement as later versions bring significant performance gains diff --git a/requirements.txt b/requirements.txt index 6897d8a2a..94e96967d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -119,7 +119,7 @@ mistune==0.8.4 # via notifications-utils notifications-python-client==6.3.0 # via -r requirements.in -notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.1 +notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@55.1.2 # via -r requirements.in openpyxl==3.0.7 # via pyexcel-xlsx From 0bec5e8f0a5111103dbcfa8eeb5f067fd7021140 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 12:16:25 +0100 Subject: [PATCH 7/8] Update pyproj from 3.2.1 to 3.3.0 --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 140114761..aab617f40 100644 --- a/requirements.in +++ b/requirements.in @@ -23,7 +23,7 @@ git+https://github.com/benoitc/gunicorn.git@1299ea9e967a61ae2edebe191082fd169b86 notifications-python-client==6.3.0 rtreelib==0.2.0 fido2==0.9.3 -pyproj==3.2.1 +pyproj==3.3.0 # PaaS awscli-cwlogs>=1.4,<1.5 diff --git a/requirements.txt b/requirements.txt index 94e96967d..066715ca1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -160,7 +160,7 @@ pyparsing==2.4.7 # via packaging pypdf2==1.26.0 # via notifications-utils -pyproj==3.2.1 +pyproj==3.3.0 # via # -r requirements.in # notifications-utils From b5fa270cd23d294302e4750e4449efc1949f939f Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Wed, 6 Apr 2022 11:35:14 +0100 Subject: [PATCH 8/8] Bump all test dependencies This results in some new errors from flake8-bugbear: ``` B020: Loop control variable overrides iterable it iterates ``` I can't see an issue with the places that we do this, so have ignored these warnings. If we keep getting these and they look fine, we can create a global rule to ignore B020. --- app/main/views/conversation.py | 2 +- app/main/views/providers.py | 4 ++-- requirements_for_test.txt | 10 +++++----- tests/app/main/views/test_templates.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/main/views/conversation.py b/app/main/views/conversation.py index 6e7fd257f..5125b6709 100644 --- a/app/main/views/conversation.py +++ b/app/main/views/conversation.py @@ -100,7 +100,7 @@ def get_user_number(service_id, notification_id): def get_sms_thread(service_id, user_number): - for notification in sorted(( + for notification in sorted(( # noqa: B020 notification_api_client.get_notifications_for_service(service_id, to=user_number, template_type='sms')['notifications'] + diff --git a/app/main/views/providers.py b/app/main/views/providers.py index cbdb581d7..d08128f7b 100644 --- a/app/main/views/providers.py +++ b/app/main/views/providers.py @@ -91,7 +91,7 @@ def edit_sms_provider_ratio(): def _get_versions_since_switchover(provider_id): - for version in sorted( + for version in sorted( # noqa: B020 provider_client.get_provider_versions(provider_id)['data'], key=lambda version: version['updated_at'] or '' ): @@ -109,7 +109,7 @@ def _chunk_versions_by_day(versions): days = defaultdict(list) - for version in sorted(versions, key=lambda version: version['updated_at'] or '', reverse=True): + for version in sorted(versions, key=lambda version: version['updated_at'] or '', reverse=True): # noqa: B020 days[ format_date_numeric(version['updated_at']) ].append(version) diff --git a/requirements_for_test.txt b/requirements_for_test.txt index ebc9f0e5c..6b37f9ee3 100644 --- a/requirements_for_test.txt +++ b/requirements_for_test.txt @@ -1,15 +1,15 @@ -r requirements.txt isort==5.10.1 -pytest==7.0.1 +pytest==7.1.1 pytest-env==0.6.2 pytest-mock==3.7.0 pytest-xdist==2.5.0 beautifulsoup4==4.10.0 -freezegun==1.1.0 +freezegun==1.2.0 flake8==4.0.1 -flake8-bugbear==22.1.11 +flake8-bugbear==22.3.23 flake8-print==4.0.0 -moto==3.0.5 +moto==3.1.4 requests-mock==1.9.3 # used for creating manifest file locally -jinja2-cli[yaml]==0.8.1 +jinja2-cli[yaml]==0.8.2 diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index f8b5c0c13..80ad278c1 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -1288,7 +1288,7 @@ def test_choose_a_template_to_copy( assert len(actual) == len(expected) - for actual, expected in zip(actual, expected): + for actual, expected in zip(actual, expected): # noqa: B020 assert normalize_spaces(actual.text) == expected links = page.select('main nav a') @@ -1354,7 +1354,7 @@ def test_choose_a_template_to_copy_when_user_has_one_service( assert len(actual) == len(expected) - for actual, expected in zip(actual, expected): + for actual, expected in zip(actual, expected): # noqa: B020 assert normalize_spaces(actual.text) == expected assert page.select('main nav a')[0]['href'] == url_for( @@ -1437,7 +1437,7 @@ def test_choose_a_template_to_copy_from_folder_within_service( assert len(actual) == len(expected) - for actual, expected in zip(actual, expected): + for actual, expected in zip(actual, expected): # noqa: B020 assert normalize_spaces(actual.text) == expected links = page.select('main nav a')