Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstream alphagov updates #11

Open
wants to merge 289 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
289 commits
Select commit Hold shift + click to select a range
e9207df
Minor version bump to 76.2.0
quis May 9, 2024
72218cc
Merge pull request #1118 from alphagov/copy-pyproject-toml
quis Jun 3, 2024
91ee6c5
Look at `requirements.txt` to determine installed version
quis Jun 3, 2024
de17049
Patch version bump to 77.1.1
quis Jun 3, 2024
ee8f279
Merge pull request #1122 from alphagov/requirements-txt-not-in
quis Jun 4, 2024
bc48366
NotifyTask: include pid and other structured fields in completion logs
risicle Apr 19, 2024
50632d4
Bump version to 77.2.0
risicle Apr 19, 2024
9ce8ae4
Merge pull request #1114 from alphagov/ris-celery-log-pid-etc
risicle Jun 5, 2024
b745ec2
Ensure no stale data in Redis if Redis fails to delete cache key
idavidmcdonald May 21, 2024
1e14b31
Try second redis delete when updating API resource to avoid race
idavidmcdonald May 22, 2024
61e0cf0
Bump version to 77.2.1
idavidmcdonald May 22, 2024
05e1bb0
Merge pull request #1120 from alphagov/redis-delete-change
idavidmcdonald Jun 6, 2024
919f39c
move postal_address.py to new recipient_validation folder
leohemsted May 8, 2024
c6265d8
move recipient validation errors to their own file
leohemsted May 8, 2024
0de634b
move phone number validation to its own file
leohemsted May 8, 2024
d17f295
move email validation to its own file
leohemsted May 8, 2024
dfc4553
change imports in recipient.py
leohemsted May 8, 2024
869b244
changelog and major version bump
leohemsted May 8, 2024
f815c64
Merge pull request #1116 from alphagov/refactor-validation
leohemsted Jun 7, 2024
bceaaf8
Restrict postcodes to valid UK postcode zones
quis Jun 11, 2024
e5d7ae7
Refactor into data file
quis Jun 11, 2024
9cf5978
Remove special case for Gibraltar
quis Jun 11, 2024
dc68a33
Minor version bump to 78.1.0
quis Jun 11, 2024
daa0016
Merge pull request #1124 from alphagov/postcode-zones
quis Jun 11, 2024
47cfcdf
bump minimum versions of subdependencies
leohemsted Jun 10, 2024
4eb96e3
add 2026 bank holidays
leohemsted Jun 10, 2024
b12ea37
Merge pull request #1123 from alphagov/bump-subdeps
leohemsted Jun 12, 2024
26c86b6
Enable pyupgrade linting rules
quis May 8, 2024
38d37f0
Add flake8-comprehensions linter
quis May 9, 2024
a8dc6c0
Add flake8-implicit-str-concat linter
quis May 9, 2024
8016ce3
Add flake8-raise linter
quis May 9, 2024
71483b5
Add flake8-pie linter
quis May 9, 2024
838f066
Major version bump to 79.0.0
quis Jun 3, 2024
fd36495
Update tests/test_field.py
quis Jun 19, 2024
ed82ae9
Remove unused exception
quis Jun 19, 2024
27311ac
Ignore linter-generated changes in git blame
quis Jun 19, 2024
e040ab2
Merge pull request #1117 from alphagov/pyupgrade
quis Jun 19, 2024
5944fb0
Return Zendesk ticket ID when creating a ticket
klssmith Jun 28, 2024
458215b
Patch version bump to 79.0.1
klssmith Jun 28, 2024
dfc9067
Merge pull request #1128 from alphagov/zdesk-client-ticket-id
klssmith Jul 1, 2024
c9aa500
Add common dependencies to `requirements.in`
quis Jun 26, 2024
9cfe813
Rationalise test dependencies
quis Jun 26, 2024
69e5059
Split common test requirements into their own file
quis Jun 26, 2024
eff4f36
Rename command to be more generic
quis Jun 26, 2024
d2676e0
Copy common test requirements into apps
quis Jun 26, 2024
e84b57b
Add `.pre-commit-config.yaml` to common config files
quis Jun 26, 2024
6ce6fbc
Major version bump
quis Jun 26, 2024
f596168
Merge pull request #1127 from alphagov/add-common-dependencies
quis Jul 1, 2024
27c7c0f
Reduce minimum required version of Gunicorn
quis Jul 1, 2024
7d1a6ec
Patch version bump
quis Jul 2, 2024
bb98d48
Merge pull request #1129 from alphagov/reduce-min-gunicorn-version
quis Jul 2, 2024
67492dd
add more UK-based test cases ahead
leohemsted Jun 11, 2024
bb81009
Move InvalidPhoneError messages to a dict within the exception obj
leohemsted Jun 12, 2024
ee656d3
dont test for content in unittests
leohemsted Jun 12, 2024
af4b88c
add legacy v2 api error messages
leohemsted Jun 12, 2024
ec33320
major version bump
leohemsted Jun 12, 2024
f1fe47c
Merge pull request #1125 from alphagov/invalid-phone-error-refactor
leohemsted Jul 3, 2024
d7765c6
rework validation test cases
leohemsted Jun 18, 2024
3fe550e
use phonenumbers to validate uk landlines
leohemsted Jun 12, 2024
ec6fc0e
add code to handle international numbers without + or 00 prefix
leohemsted Jun 18, 2024
f4d7550
tweak a couple of test cases:
leohemsted Jun 18, 2024
34fed37
change UKLandline to PhoneNumber and make it instanced
leohemsted Jul 1, 2024
fc2a2a4
add additional helper methods to the PhoneNumber class
leohemsted Jul 1, 2024
948abee
update helper functions to handle notify quirks
leohemsted Jul 1, 2024
450c30c
Update test cases to use semantically valid phone numbers
leohemsted Jul 1, 2024
9311e34
normalise and retry phone numbers if validation fails
leohemsted Jul 3, 2024
680dbbf
add some more test cases for validation
leohemsted Jul 3, 2024
c4971ac
normalise numbers and retry if they fail validation
CrystalPea Jul 3, 2024
c761829
Changes following PR review:
CrystalPea Jul 9, 2024
e660635
Version bump
CrystalPea Jul 9, 2024
3a28456
Merge pull request #1126 from alphagov/phone-number-validation
rparke Jul 9, 2024
ef7a74c
The phonenumbers library (correctly) does not consider telephone
rparke Jul 15, 2024
0a04a4f
Merge pull request #1130 from alphagov/add-support-for-uk-tv-numbers
rparke Jul 16, 2024
664d78c
added missing changelog for 81.1.1
rparke Jul 18, 2024
f8cba01
Merge pull request #1132 from alphagov/add-support-for-uk-tv-numbers-…
rparke Jul 18, 2024
568a6e5
Add validation for fixed abode addresses to `PostalAddress`
klssmith Jul 17, 2024
6585998
Bump version from 81.1.0 to 82.0.0
klssmith Jul 17, 2024
2c16947
Merge pull request #1131 from alphagov/nfa-validation
klssmith Jul 22, 2024
d2327b6
Add new web request log fields. Namely, environment_name, request_siz…
corlettb Jul 22, 2024
7e0b5cd
Update changelog and version
corlettb Jul 22, 2024
cd4b5c8
Merge pull request #1133 from alphagov/BC-more-log-fields
corlettb Jul 23, 2024
8e31cdd
Fix the way we log the request_size. Accessing the data at this point…
corlettb Jul 25, 2024
176fc9c
Merge pull request #1135 from alphagov/BC-request-size-fix
corlettb Jul 25, 2024
a48f05d
Write to requirements.txt if no requirements.in
quis Jul 31, 2024
87e0f82
Merge pull request #1137 from alphagov/write-to-existant-requirements…
quis Jul 31, 2024
e151f66
Add `unsubscribe_link` argument to email templates
quis Jul 26, 2024
8120279
Merge pull request #1136 from alphagov/unsubscribe-link-email-template
quis Jul 31, 2024
260e7bd
Separate out check for if service can't send to international but tri…
rparke Aug 6, 2024
c20db73
Merge pull request #1138 from alphagov/validation-error-precedence-fix
rparke Aug 6, 2024
4a65c78
Premium rate landline numbers are a known vector of attack this adds
rparke Jul 25, 2024
2ac226f
Merge pull request #1134 from alphagov/disallow-premium-landlines
rparke Aug 7, 2024
dd0121d
Add new areas to international billing rates
klssmith Aug 1, 2024
74a24bd
Bump version to 82.4.0
klssmith Aug 7, 2024
4825b66
Merge pull request #1139 from alphagov/update-int-sms-billing
klssmith Aug 7, 2024
719c7a5
updates recipientcsv to use new validation code for services with sms…
rparke Aug 14, 2024
c79497e
Merge pull request #1141 from alphagov/sms_to_uk_landlines_csv_valida…
rparke Aug 16, 2024
7393546
add LazyLocalGetter and tests
risicle Aug 21, 2024
17617df
Bump version to 82.6.0
risicle Aug 21, 2024
36ce1da
Merge pull request #1142 from alphagov/ris-lazy-local-getter
risicle Aug 23, 2024
622b013
Adds validation check to PhoneNumber so that the error `TOO_SHORT` is…
rparke Aug 29, 2024
0ae0a55
small commit
rparke Sep 2, 2024
22dbe79
small commit revert
rparke Sep 2, 2024
7841d79
Merge pull request #1146 from alphagov/bug-fix-empty-field-wrong-v2-e…
rparke Sep 2, 2024
1563a7c
LazyLocalGetter: add expected_type mechanism
risicle Aug 30, 2024
d4e961a
Bump version to 82.7.0
risicle Sep 2, 2024
d72195a
Bump test requirements to the latest versions
quis Aug 9, 2024
a9224a8
Minor version bump
quis Aug 14, 2024
a070787
Merge pull request #1147 from alphagov/ris-lazy-local-getter-improvem…
risicle Sep 10, 2024
12e9aa6
AntivirusClient: use a persistent requests session
risicle Aug 23, 2024
08227b2
ZendeskClient: use a persistent requests session
risicle Aug 23, 2024
2dec970
Bump version to 83.0.0
risicle Aug 23, 2024
4caaf05
Merge pull request #1145 from alphagov/ris-api-clients-requests-session
risicle Sep 11, 2024
79d1674
Updates phone_numbers library to 8.13.45 to fix a validation bug with…
rparke Sep 12, 2024
156d855
Merge pull request #1149 from alphagov/bug-fix-cannot-send-to-jersey-…
rparke Sep 12, 2024
259c8e9
Revert "ZendeskClient: use a persistent requests session"
risicle Sep 12, 2024
e7f9814
Revert "AntivirusClient: use a persistent requests session"
risicle Sep 12, 2024
16c09a0
Bump version to 84.0.0
risicle Sep 12, 2024
37e6089
Merge pull request #1150 from alphagov/ris-revert-api-client-changes
risicle Sep 12, 2024
886f6f4
Drop Girobank’s postcode from validation
quis Aug 23, 2024
af37fab
Merge branch 'main' into bump-test-requirements
quis Sep 13, 2024
e36a6d6
Merge pull request #1140 from alphagov/bump-test-requirements
quis Sep 13, 2024
a79ba61
Merge branch 'main' into drop-girobank-postcode
quis Sep 13, 2024
484d453
Automatically copy config after version bump
quis Sep 16, 2024
742a8c9
Merge pull request #1144 from alphagov/drop-girobank-postcode
quis Sep 16, 2024
2eb898e
Add a new custom field to the Zendesk client
klssmith Sep 17, 2024
468057f
Minor version bump to 84.2.0
klssmith Sep 17, 2024
4dcc073
Merge pull request #1153 from alphagov/user-creation-date-zendesk
klssmith Sep 17, 2024
cc93730
Merge pull request #1151 from alphagov/copy-config-after-version-bump
quis Sep 19, 2024
390e083
Migrate asset fingerprinter from utils
quis Sep 9, 2024
998a6b2
Use Pathlib to read files contents
quis Sep 9, 2024
a41815b
Appease Ruff
quis Sep 9, 2024
16c1b91
Minor version bump
quis Sep 9, 2024
3f98108
Revert "Bump test requirements to the latest versions"
quis Sep 19, 2024
52fa4aa
Minor version bump
quis Sep 19, 2024
d917214
Merge pull request #1154 from alphagov/revert-84.1.0
quis Sep 19, 2024
305010e
Added allow_landline argument to PhoneNumber constructor
rparke Aug 21, 2024
316b33f
Don’t require implementation of `ALLOWED_PROPERTIES`
quis Sep 20, 2024
9705593
Rewrite `SerialisedModel` to use annotations
quis Sep 20, 2024
bd74a5c
Add type coercion for primitive types
quis Sep 20, 2024
fcf1466
Support inheritence of annotations
quis Sep 20, 2024
e5cfe79
Major version bump
quis Sep 20, 2024
8bd1c4b
Separate out parsing of possible numbers and validation of allowed nu…
rparke Aug 30, 2024
8272d1d
Merge pull request #1156 from alphagov/serialised-model-annotations
quis Sep 20, 2024
33fbb2d
Merge branch 'main' into add-allow-landline-flag
rparke Sep 20, 2024
ee4f6d1
Merge pull request #1143 from alphagov/add-allow-landline-flag
rparke Sep 20, 2024
c205017
Rename test for clarity
quis Sep 27, 2024
924bd92
add EventletTimeoutMiddleware
risicle Oct 2, 2024
024987d
Bump version to 86.1.0
risicle Oct 2, 2024
51eb8f6
Merge pull request #1157 from alphagov/ris-eventlet-timeout-middleware
risicle Oct 3, 2024
2eb50b8
Merge branch 'main' into migrate-asset-fingerprinter
quis Oct 7, 2024
34f0118
Merge pull request #1148 from alphagov/migrate-asset-fingerprinter
quis Oct 7, 2024
c5a9a43
Revert "Revert "ZendeskClient: use a persistent requests session""
risicle Sep 16, 2024
fb7776c
Revert "Revert "AntivirusClient: use a persistent requests session""
risicle Sep 16, 2024
10234ac
Bump version to 87.0.0
risicle Sep 16, 2024
acc3f84
Merge pull request #1152 from alphagov/ris-reintroduce-api-client-cha…
risicle Oct 23, 2024
8abff85
Remove `EmailPreviewTemplate`
quis Oct 25, 2024
41e526d
Major version bump
quis Oct 25, 2024
1d6c706
logging: don't calculate_content_length() for after_request logs of s…
risicle Oct 25, 2024
0416d78
logging: emit log message when a streaming response is closed
risicle Oct 28, 2024
40f4f46
Bump version to 87.1.0
risicle Oct 28, 2024
68ed64c
Merge pull request #1160 from alphagov/ris-after-request-log-dont-con…
risicle Oct 29, 2024
0596365
Merge branch 'main' into remove-email-preview-template
quis Oct 29, 2024
ec55878
Merge pull request #1159 from alphagov/remove-email-preview-template
quis Oct 29, 2024
408f0dd
logging: don't use current_app in _log_response_closed
risicle Oct 29, 2024
463585f
Bump version to 88.0.1
risicle Oct 29, 2024
1cff3ca
Merge pull request #1161 from alphagov/ris-log-response-closed-fix
risicle Oct 30, 2024
4502fa3
logging: refactor filters to fall back to provided record fields if a…
risicle Oct 30, 2024
c4c55ec
logging: manually supply request_id etc for streaming-response-closed…
risicle Oct 30, 2024
5a27a7e
Bump version to 88.1.0
risicle Oct 30, 2024
d93b4ad
Merge pull request #1162 from alphagov/ris-logging-refactor-filters-f…
risicle Oct 31, 2024
12bc970
Bug Fix: Updates PhoneNumbers to 8.13.48 to apply fix to metadata tha…
rparke Oct 31, 2024
85c06be
Merge pull request #1163 from alphagov/uganda-phonenumber-validation-fix
rparke Oct 31, 2024
edefe08
Freeze all test requirements
quis Nov 7, 2024
d8e14e6
Make `requirements_for_test_common` a `.in` file
quis Nov 8, 2024
16f8b65
Major version bump
quis Nov 8, 2024
192705d
Merge pull request #1164 from alphagov/freeze-requirements
quis Nov 11, 2024
46b6715
raise an exception if we cant fetch from github
leohemsted Nov 11, 2024
43a69c3
Merge pull request #1165 from alphagov/github-flakes
leohemsted Nov 11, 2024
9267e17
version_tools: move to own sub-package
risicle Sep 20, 2024
640c50d
version_tools: use importlib.resources for copying config files
risicle Nov 12, 2024
51cc11e
version_tools: add symlinks to copy_config files in old locations
risicle Nov 12, 2024
af72603
version_tools: use importlib.metadata for get_app_version
risicle Sep 20, 2024
387386e
update reqs for test using current freeze script
leohemsted Nov 12, 2024
5349c6a
install utils in development mode during bootstrap
leohemsted Nov 12, 2024
9b08216
version bump
leohemsted Nov 12, 2024
4f8e655
Merge pull request #1166 from alphagov/ris-version-tools-importlib-new
leohemsted Nov 12, 2024
f7f12c4
use gh api rather than raw.githubusercontent cdn
leohemsted Nov 12, 2024
dbfaefb
minor version bump
leohemsted Nov 12, 2024
4741402
Merge pull request #1167 from alphagov/use-gh-api
leohemsted Nov 14, 2024
d9263a4
Allow leading empty columns in CSV files
quis Nov 20, 2024
5e4677d
Major version bump
quis Nov 20, 2024
febec8e
Merge pull request #1169 from alphagov/leading-empty-columns
quis Nov 21, 2024
ae26e97
removed old phonenumber validation code
rparke Oct 28, 2024
e7718b7
removed old validation code from the tests, and just replaced like fo…
rparke Oct 28, 2024
43df61f
Updated error codes as a result of limitations in natively inpecting …
rparke Oct 28, 2024
93b1a57
Replaces invalid numbers for the countries under test with truly vali…
rparke Oct 29, 2024
8e3c583
Remove unneded tests
rparke Oct 29, 2024
5f11c55
Updated recipients.py to exclusively use the new library
rparke Oct 29, 2024
f6eff96
updated test_international_billing_rates.py to use new validation code
rparke Oct 29, 2024
8d46948
adds real return values to mocked method notifications_utils.recipien…
rparke Oct 31, 2024
ca6c446
Only have one parsed phone number object and have it be authoritative
rparke Nov 6, 2024
2612614
added code for correctly parsing non-emergency three digit numbers
rparke Nov 14, 2024
4233bbe
update phonenumbers to 8.13.50
rparke Nov 25, 2024
031f31b
bump version 91.0.0
rparke Nov 25, 2024
21700cc
Merge pull request #1158 from alphagov/remove-old-phonenumber-validation
rparke Nov 25, 2024
b7ff22e
Adds correct handling of TV numbers so that they are reported is non-…
rparke Nov 27, 2024
7540e00
Move phone info utility methods to public
rparke Nov 27, 2024
c1086f7
rename billable_units to rate_multiplier
rparke Nov 27, 2024
3fc6d2f
version bump
rparke Nov 27, 2024
79fe506
Merge pull request #1171 from alphagov/tv-number-international-info-fix
rparke Nov 27, 2024
be37027
bump requests
leohemsted Nov 27, 2024
220ac1c
Merge pull request #1172 from alphagov/bump-requests
leohemsted Nov 29, 2024
4b1548c
fix: unsupported countries were not being rejected
leohemsted Nov 29, 2024
71eeb97
chore: use set comparison rather than checking in list
leohemsted Nov 29, 2024
3f68d8e
bump version
leohemsted Nov 29, 2024
959af06
Merge pull request #1173 from alphagov/fix-ascencion-island-bug
leohemsted Dec 2, 2024
2d7d6e4
Revert "Automatically copy config after version bump"
quis Nov 20, 2024
dade07b
Patch version bump
quis Nov 20, 2024
e82224a
Merge pull request #1168 from alphagov/dont-copy-config-after-bump
quis Dec 3, 2024
f9b8fc9
bump test dependency versions
leohemsted Dec 5, 2024
36f5b14
bump version
leohemsted Dec 5, 2024
d4ccb24
bump black and ruff to latest versions
leohemsted Dec 9, 2024
d4d07fd
Merge pull request #1175 from alphagov/bump-test-utils
leohemsted Dec 9, 2024
1a1b1f0
Remove hangul filler from emails
quis May 16, 2024
7f2651c
Patch version bump
quis Dec 6, 2024
737c6e3
Merge pull request #1177 from alphagov/hangul-filler
quis Dec 11, 2024
1385894
Remove flake8 config from setup.cfg
quis Dec 6, 2024
962ade4
Patch version bump
quis Dec 6, 2024
3bd28f8
Merge pull request #1176 from alphagov/clean-up-flake8-config
quis Dec 11, 2024
82d3e05
Revert "Merge pull request #1158 from alphagov/remove-old-phonenumber…
rparke Dec 16, 2024
c1e04db
Fix key issue where rate_multiplier and billing rate were inconsisten…
rparke Dec 16, 2024
36ccb7e
Fix prefix matching error to start with longer (thus more specific) p…
rparke Dec 16, 2024
55cb9e5
Merge pull request #1178 from alphagov/revert-remove-old-phonenumber-…
rparke Dec 16, 2024
fab4e3b
Bump core dependencies to latest versions
quis Nov 20, 2024
7dc2c38
Patch version bump
quis Nov 29, 2024
9d8b26f
Merge pull request #1170 from alphagov/bump-core-dependencies
quis Dec 30, 2024
30eef0e
Downgrade minimum version of requests to 2.32.3
quis Dec 30, 2024
7793546
Merge pull request #1180 from alphagov/downgrade-requests
quis Dec 31, 2024
1b1b861
RequestCache tests: make mocker last fixture argument
risicle Dec 14, 2024
f18fb7e
RequestCache: add CacheResultWrapper to allow dynamic cache decisions
risicle Dec 14, 2024
4337ea1
Bump version to 92.1.0
risicle Dec 14, 2024
bbdc5b4
Merge pull request #1179 from alphagov/ris-request-cache-decision-wra…
risicle Jan 7, 2025
68a818e
Bump minimum jinja2 version to latest
quis Jan 8, 2025
b9ef1b4
Merge pull request #1183 from alphagov/jinja-3.1.5
quis Jan 8, 2025
0672b05
eventlet: add account_greenlet_times and accessor functions
risicle Dec 20, 2024
b65c438
logging: move contents of __init__.py to flask.py
risicle Dec 21, 2024
5a66f6e
logging: annotate request_cpu_time to app.request logs
risicle Dec 21, 2024
00d92c5
logging: emit greenlet stats from app.request calls if NOTIFY_EVENTLE…
risicle Dec 23, 2024
9ad0bd9
Bump version to 93.0.0
risicle Dec 31, 2024
7322d35
Merge pull request #1181 from alphagov/ris-eventlet-time-accounting
risicle Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# bulk change for black formatting changes
0f3f4b3e6aa5a199a1b5e79742aa776ce8d8bf7e
ce619c18021e1a219cac2da4e3b0470ddfc08508

# adding more linters to ruff
26c86b6a8814b0f5948d9f1ea271d67141dbf50e
38d37f09cb9472e60888bd5117f4e3b89c628b9f
a8dc6c00113091ed735fa832881ff696fb1f632f
8016ce3a6b16f3d30ed2ff6731fd20851c2b4803
71483b5fb0251dd9e99f6cd45060df3c934cd7c1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ nosetests.xml
coverage.xml
*,cover
.pytest_cache/
.testmondata*

# Translations
*.mo
Expand Down
18 changes: 0 additions & 18 deletions .pre-commit-config.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .pre-commit-config.yaml
294 changes: 294 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,299 @@
# CHANGELOG

## 93.0.0

* BREAKING CHANGE: logging: all contents of `logging/__init__.py` have been moved to `logging/flask.py` because they all assume a flask(-like) environment and this way we don't implicitly import all of flask etc. every time anything under `logging` is imported.
* Adds `request_cpu_time` to `app.request` logs when available.
* Adds ability to track eventlet's switching of greenlets and annotate `app.request` logs with useful metrics when the flask config parameter `NOTIFY_EVENTLET_STATS` is set and the newly provided function `account_greenlet_times` is installed as a greenlet trace hook.

## 92.1.1

* Bump minimum version of `jinja2` to 3.1.5

## 92.1.0

* RequestCache: add CacheResultWrapper to allow dynamic cache decisions

## 92.0.2

* Downgrade minimum version of `requests` to 2.32.3

## 92.0.1

* Bumps core dependencies to latest versions

## 92.0.0

* Restores old validation code so later utils changes can be added to api, admin etc.

## 91.1.2

* Adds rule N804 (invalid-first-argument-name-for-class-method) to linter config

## 91.1.1

* Remove hangul filler character from rendered emails

## 91.1.0

* bump all libs in requirements_for_test_common.in

## 91.0.4

* Don’t copy config when bumping utils version

## 91.0.3

* Fix validating supported international country codes for phone numbers without a leading "+" that look a bit like UK numbers

## 91.0.2

* Bumps requests to newer version

## 91.0.1

* Adds public utility method to check if a phonenumber is international (with correct handling for OFCOM TV numbers)
* Updates PhoneNumber.get_international_phone_info to return the correct info for OFCOM TV numbers

## 91.0.0

* BREAKING CHANGE: All standalone functions for validating, normalising and formatting phone numbers has been removed from notifications_utils/recipient_validation/phone_number.py, and are replaced and encapsualated entirely with a single `PhoneNumber` class. All code that relies on validation, normalisation or fomratting of a phone number must be re-written to use instances of `PhoneNumber` instead.

## 90.0.0

* Allow leading empty columns in CSV files
* Change second argument of `formatters.strip_all_whitespace` (this argument is not used in other apps)

## 89.2.0

* Use github API rather than fetching from their CDN in version_tools

## 89.1.0

* Change version_tools to a package that uses importlib to grab common reqs/config, rather than fetching common files from github. This repo's usage of those common files are now symlinks to the sources of truth found within notification_utils/version_tools/

## 89.0.1

* Raise an exception if we cant fetch remote github files in version_tools.py

## 89.0.0

* `requirements_for_test_common.txt` is now `requirements_for_test_common.in`. Apps should freeze this into a local requirements file for fully reproducible dependencies

## 88.1.1

* Bug fix: applies minor version bump of PhoneNumbers to v8.13.48 to apply a fix to the UG metadata which was causing validation to fail in error

## 88.1.0

* logging: slightly redesign filters behaviour to allow log-call-supplied request_id, span_id, user_id, service_id to be used if they are not available by normal means. Supply these manually for the streaming-response-closed log message.

## 88.0.1

* logging: don't use current_app in _log_response_closed

## 88.0.0

* Removes `template.EmailPreviewTemplate` (only used in admin app)

## 87.1.0

* logging: don't calculate_content_length() for after_request logs of streaming responses - this caused attempted streaming responses to be eagerly consumed, negating the point of streaming responses. Instead emit the after_request log when status code and header is returned and a separate log message when a streaming response is closed.

## 87.0.0

* Reintroduce changes to `AntivirusClient` and `ZendeskClient` from 83.0.0

## 86.2.0

* Adds `asset_fingerprinter.AssetFingerprinter` to replace the versions duplicated across our frontend apps

## 86.1.0

* Add `EventletTimeoutMiddleware`

# 86.0.0

* BREAKING CHANGE: The `Phonenumber` class now accepts a flag `allow_landline`, which defaults to False. This changes the previous default behaviour, allowing landlines.

## 85.0.0

* Removes `SerialisedModel.ALLOWED_PROPERTIES` in favour of annotations syntax

## 84.3.0

* Reverts 84.1.0

## 84.2.0

* The Zendesk client takes a new optional argument, `user_created_at` which populates a new field on the Notify Zendesk form if provided.

## 84.1.1

* Remove GIR 0AA from valid postcodes

## 84.1.0

* Bump versions of common test dependencies (run `make bootstrap` to copy these into your app)

## 84.0.0

* `AntivirusClient` and `ZendeskClient` have returned to their behaviour as of 82.x.x to allow the 83.0.1 fix to go out to apps without the required changes.

# 83.0.1

* Updates phone_numbers to 8.13.45 to apply a fix to the metadata for phone numbers that was discovered causing a subset of valid Jersey numbers to be incorrectly invalidated

## 83.0.0

* `AntivirusClient` and `ZendeskClient` are no longer thread-safe because they now use persistent requests sessions. Thread-local instances should be used in place of any global instances in any situations where threading is liable to be used
* `AntivirusClient` and `ZendeskClient` have had their `init_app(...)` methods removed as this is an awkward pattern to use for initializing thread-local instances. It is recommended to use `LazyLocalGetter` to construct new instances on-demand, passing configuration parameters via the constructor arguments in a `factory` function.

## 82.7.0

* Add `expected_type` mechanism to `LazyLocalGetter`

# 82.6.1

* Adds validation check to `PhoneNumber` so that it returns the expected error message `TOO_SHORT` if an empty string is passed. This has caused issues with users of the v2 API getting inconsistent error messages

## 82.6.0

* Add `LazyLocalGetter` class for lazily-initialized context-local resources

## 82.5.0

* Add support for validation of UK landlines for services with sms_to_uk_landlines enabled using CSV flow

## 82.4.0

* Add support for sending SMS to more international numbers. Sending to Eritrea, Wallis and Futuna, Niue, Kiribati, and Tokelau is now supported.

## 82.3.0
* Extends the validation logic for the `PhoneNumber` class to disallow premium rate numbers

## 82.2.1

* Add fix to recipient_validation/phone_number.py to raise correct error if a service tries to send to an international number without that permission

## 82.2.0
* Add `unsubscribe_link` argument to email templates

## 82.1.2
* Write updated version number to `requirements.txt` if no `requirements.in` file found

## 82.1.1
* Fix the way we log the request_size. Accessing the data at this point can trigger a validation error early and cause a 500 error

## 82.1.0
* Adds new logging fields to request logging. Namely environment_name, request_size and response_size

## 82.0.0

* Change `PostalAddress` to add `has_no_fixed_abode_address` method. No fixed abode addresses are now considered invalid.

## 81.1.1
* Adds condition to validation to allow TV Numbers (https://www.ofcom.org.uk/phones-and-broadband/phone-numbers/numbers-for-drama/) for UK mobiles

## 81.1.0
* introduce new validation class - `PhoneNumber`, that we will use for services that want to send sms
to landline (and in the future this new code can be extended for all phone number validation)
* in this new class, we use `phonenumbers` library for validating phone numbers, instead of our custom valdiation code


## 81.0.0

* BREAKING CHANGE: The constructor for `notification_utils.recipient_validation.errors.InvalidPhoneError`
- When raising InvalidPhoneError, instead of supplying a custom message, you must create an error by supplying a code from the `InvalidPhoneError.Codes` enum
* `InvalidPhoneError.code` will contain this machine-readable code for an exception if you need to examine it later
* `InvalidPhoneError.get_legacy_v2_api_error_message` returns a historical error message for use on the public v2 api

## 80.0.1

* Reduces minimum required Gunicorn version for compatibility

## 80.0.0

* Copies additional config files from utils into repos
* Renames `version_tools.copy_pyproject_yaml` to `version_tools.copy_config`

## 79.0.1

* Update the `send_ticket_to_zendesk` method of the ZendeskClient to return the ID of the ticket that was created.

## 79.0.0

* Switches on Pyupgrade and a bunch of other more opinionated linting rules

## 78.2.0

* Bumped minimum versions of select subdependencies

## 78.1.0

* Restrict postcodes to valid UK postcode zones

## 78.0.0

* BREAKING CHANGE: recipient validation code has all been moved into separate files in a shared folder. Functionality is unchanged.
- Email address validation can be found in `notifications_utils.recipient_validation.email_address`
- Phone number validation can be found in `notifications_utils.recipient_validation.phone_number`
- Postal address validation can be found in `notifications_utils.recipient_validation.postal_address`
* BREAKING CHANGE: InvalidPhoneError and InvalidAddressError no longer extend InvalidEmailError.
- if you wish to handle all recipient validation errors, please use `notifications_utils.recipient_validation.errors.InvalidRecipientError`

## 77.2.1

* Change redis delete behaviour to error, rather than end up with stale data, if Redis is unavailable.

## 77.2.0

* `NotifyTask`: include pid and other structured fields in completion log messages

## 77.1.1

* Fix how `version_tools.copy_pyproject_toml` discovers the current version of notifications-utils

## 77.1.0

* Add `version_tools.copy_pyproject_toml` to share linter config between apps

## 77.0.0

* Breaking change to the Zendesk Client. The `ticket_categories` argument has been replaced with a `notify_task_type` argument, and it now populates
a different Zendesk form.

## 76.1.0

* Remove `check_proxy_header_before_request` from request_helper.py since this was only used when apps
were deployed on the PaaS.

## 76.0.2

* linting changes

## 76.0.1

* Reject Gibraltar’s postcode (`GX11 1AA) when validating postal addresses

## 76.0.0

* Remove use of `NOTIFY_RUNTIME_PLATFORM` and `NOTIFY_LOG_PATH` flask config parameters, which no longer did anything. Technically this only affects users if the consumed the paramter themselves and relied on utils code setting default values for them.

## 75.2.0

* Add `InsensitiveSet` class (behaves like a normal set, but with uniqueness determined by normalised values)

## 75.1.1

* Don't set `statsd_host` in `set_gunicorn_defaults` - not all apps have statsd.

## 75.1.0

* Split `logging.formatting` submodule out of `logging` module. All components should remain
accessible via the `logging` module, so this shouldn't affect existing code.
* Introduce `gunicorn_defaults` module.

## 75.0.0

* BREAKING CHANGE: notifications_utils/clients/encryption/encryption_client has been removed. It
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ recursive-include notifications_utils *.jinja2
recursive-include notifications_utils *.json
recursive-include notifications_utils *.txt
include notifications_utils/international_billing_rates.yml
include notifications_utils/version_tools/.pre-commit-config.yaml
include notifications_utils/version_tools/pyproject.toml
include notifications_utils/version_tools/requirements_for_test_common.in
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ SHELL := /bin/bash
help:
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: freeze-requirements
freeze-requirements: ## Pin all test requirements including sub dependencies into requirements_for_test.txt
pip install --upgrade pip-tools
pip-compile requirements_for_test.in setup.py --output-file requirements_for_test.txt

.PHONY: bootstrap
bootstrap: ## Build project
pip install -r requirements_for_test.txt
pip install -e .

.PHONY: test
test: ## Run tests
Expand All @@ -16,6 +22,10 @@ test: ## Run tests
pytest -n auto
python setup.py sdist

.PHONY: watch-tests
watch-tests: ## Automatically rerun tests
ptw --runner "pytest --testmon -n auto"

clean:
rm -rf cache venv

Expand Down
9 changes: 0 additions & 9 deletions notifications_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
SMS_CHAR_COUNT_LIMIT = 918 # 153 * 6, no network issues but check with providers before upping this further
LETTER_MAX_PAGE_COUNT = 10

# regexes for use in recipients.validate_email_address.
# Valid characters taken from https://en.wikipedia.org/wiki/Email_address#Local-part
# Note: Normal apostrophe eg `Firstname-o'[email protected]` is allowed.
# hostname_part regex: xn in regex signifies possible punycode conversions, which would start `xn--`;
# the hyphens are matched for later in the regex.
hostname_part = re.compile(r"^(xn|[a-z0-9]+)(-?-[a-z0-9]+)*$", re.IGNORECASE)
tld_part = re.compile(r"^([a-z]{2,63}|xn--([a-z0-9]+-)*[a-z0-9]+)$", re.IGNORECASE)
VALID_LOCAL_CHARS = r"a-zA-Z0-9.!#$%&'*+/=?^_`{|}~\-"
EMAIL_REGEX_PATTERN = r"^[{}]+@([^.@][^@\s]+)$".format(VALID_LOCAL_CHARS)
email_with_smart_quotes_regex = re.compile(
# matches wider than an email - everything between an at sign and the nearest whitespace
r"(^|\s)\S+@\S+(\s|$)",
Expand Down
Loading