Skip to content

Commit

Permalink
Merge pull request #866 from alphagov/bump-utils-94.0.1
Browse files Browse the repository at this point in the history
Bump utils to 94.0.1
  • Loading branch information
quis authored Jan 28, 2025
2 parents c69ed54 + ebe9519 commit d4e9684
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 46 deletions.
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file was automatically copied from notifications-utils@92.1.1
# This file was automatically copied from notifications-utils@94.0.1

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -9,12 +9,8 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.8.2'
rev: 'v0.9.2'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
name: black (python)
- id: ruff-format
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ run-celery-with-docker: ## Run celery in Docker container
.PHONY: test
test: ## Run tests (used by Concourse)
ruff check .
black --check .

ruff format --check .
pytest -n auto --maxfail=10

.PHONY: test-with-docker
Expand Down
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from flask import Flask, jsonify
from flask_httpauth import HTTPTokenAuth
from gds_metrics import GDSMetrics
from notifications_utils import logging as utils_logging
from notifications_utils import request_helper
from notifications_utils.celery import NotifyCelery
from notifications_utils.clients.signing.signing_client import Signing
from notifications_utils.clients.statsd.statsd_client import StatsdClient
from notifications_utils.logging import flask as utils_logging
from notifications_utils.s3 import S3ObjectNotFound, s3download, s3upload

from app import weasyprint_hack
Expand Down
2 changes: 1 addition & 1 deletion app/celery/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def copy_s3_object(source_bucket, source_filename, target_bucket, target_filenam
def _create_pdf_for_letter(
task: Task, letter_details, language: Literal["english", "welsh"], include_notify_tag: bool = True
):
logo_filename = f'{letter_details["logo_filename"]}.svg' if letter_details["logo_filename"] else None
logo_filename = f"{letter_details['logo_filename']}.svg" if letter_details["logo_filename"] else None
template = LetterPrintTemplate(
letter_details["template"],
values=letter_details["values"] or None,
Expand Down
2 changes: 1 addition & 1 deletion app/embedded_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ def embed_fonts(pdf_data):
raise Exception(
f"ghostscript font embed process failed with return code: {gs_process.returncode}\n"
f"stderr:\n"
f'{stderr.decode("utf-8")}'
f"{stderr.decode('utf-8')}"
)
return BytesIO(stdout)
2 changes: 1 addition & 1 deletion app/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _get_pdf_from_letter_json(letter_json, language="english") -> BytesIO:


def get_html(json, language="english"):
branding_filename = f'{json["filename"]}.svg' if json["filename"] else None
branding_filename = f"{json['filename']}.svg" if json["filename"] else None

return str(
LetterPreviewTemplate(
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PyMuPDF==1.24.4
WeasyPrint==59

# Run `make bump-utils` to update to the latest version
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@92.1.1
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@94.0.1

# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
prometheus-client==0.14.1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ markupsafe==2.1.5
# werkzeug
mistune==0.8.4
# via notifications-utils
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@b9ef1b45b655324d6341995afffc3ebc25a3ed72
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@d6311c3ab83b8225265277f781157c48f9318ae9
# via -r requirements.in
ordered-set==4.1.0
# via notifications-utils
Expand Down
14 changes: 2 additions & 12 deletions requirements_for_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ billiard==4.2.0
# via
# -r requirements.txt
# celery
black==24.10.0
# via -r requirements_for_test_common.in
blinker==1.9.0
# via
# -r requirements.txt
Expand Down Expand Up @@ -63,7 +61,6 @@ charset-normalizer==3.3.2
click==8.1.7
# via
# -r requirements.txt
# black
# celery
# click-didyoumean
# click-plugins
Expand Down Expand Up @@ -178,9 +175,7 @@ mistune==0.8.4
# notifications-utils
moto==4.1.5
# via -r requirements_for_test.in
mypy-extensions==1.0.0
# via black
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@b9ef1b45b655324d6341995afffc3ebc25a3ed72
notifications-utils @ git+https://github.com/alphagov/notifications-utils.git@d6311c3ab83b8225265277f781157c48f9318ae9
# via -r requirements.txt
ordered-set==4.1.0
# via
Expand All @@ -189,11 +184,8 @@ ordered-set==4.1.0
packaging==24.1
# via
# -r requirements.txt
# black
# gunicorn
# pytest
pathspec==0.12.1
# via black
pdf2image==1.12.1
# via -r requirements.txt
phonenumbers==8.13.51
Expand All @@ -206,8 +198,6 @@ pillow==9.3.0
# pdf2image
# reportlab
# weasyprint
platformdirs==4.3.6
# via black
pluggy==1.5.0
# via pytest
prometheus-client==0.14.1
Expand Down Expand Up @@ -300,7 +290,7 @@ requests-mock==1.12.1
# via -r requirements_for_test_common.in
responses==0.25.3
# via moto
ruff==0.8.2
ruff==0.9.2
# via -r requirements_for_test_common.in
s3transfer==0.10.1
# via
Expand Down
5 changes: 2 additions & 3 deletions requirements_for_test_common.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file was automatically copied from notifications-utils@92.1.1
# This file was automatically copied from notifications-utils@94.0.1

beautifulsoup4==4.12.3
pytest==8.3.4
Expand All @@ -9,5 +9,4 @@ pytest-testmon==2.1.1
requests-mock==1.12.1
freezegun==1.5.1

black==24.10.0 # Also update `.pre-commit-config.yaml` if this changes
ruff==0.8.2 # Also update `.pre-commit-config.yaml` if this changes
ruff==0.9.2 # Also update `.pre-commit-config.yaml` if this changes
30 changes: 14 additions & 16 deletions pyproject.toml → ruff.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# This file was automatically copied from notifications-utils@92.1.1
# This file was automatically copied from notifications-utils@94.0.1

[tool.black]
line-length = 120
exclude = [
"migrations/versions/",
"venv*",
"__pycache__",
"node_modules",
"cache",
"migrations",
"build",
"sample_cap_xml_documents.py",
]

[tool.ruff]
line-length = 120

target-version = "py311"

lint.select = [
[lint]
select = [
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
Expand All @@ -24,14 +32,4 @@ lint.select = [
"PIE", # flake8-pie
"N804", # First argument of a class method should be named `cls`
]
lint.ignore = []
exclude = [
"migrations/versions/",
"venv*",
"__pycache__",
"node_modules",
"cache",
"migrations",
"build",
"sample_cap_xml_documents.py",
]
ignore = []

0 comments on commit d4e9684

Please sign in to comment.