From f8fd76cff05450249d59d76f02bc05e2138062dd Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 13:57:09 -0800 Subject: [PATCH 01/17] Remove duplicate types-requests==2.31.0.2 The types-requests==2.31.0.2 dependency was double-listed right next to each other; this commit removes one. --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6dc737aab..931bc155b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -54,4 +54,3 @@ types-Pillow==10.0.0.3 types-psycopg2==2.9.21.11 types-python-dateutil==2.8.19.14 types-requests==2.31.0.2 -types-requests==2.31.0.2 From 3652ac81008fd2d0f8d640160de3178913237454 Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 15:41:06 -0800 Subject: [PATCH 02/17] Alphabetize requirements.txt Alphabetize requirements.txt for developer convenience; this helps to find duplicates and unnecessarily-pinned subdependencies, as well as making the file easier to read and use. --- requirements.txt | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/requirements.txt b/requirements.txt index 931bc155b..f41210aea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,52 +1,52 @@ aiohttp==3.9.2 bleach==5.0.1 +boto3==1.26.57 +bw-file-resubmit==0.6.0rc2 celery==5.2.7 colorthief==0.2.1 Django==3.2.24 django-celery-beat==2.4.0 -bw-file-resubmit==0.6.0rc2 django-compressor==4.3.1 +django-csp==3.7 django-imagekit==4.1.0 django-model-utils==4.3.1 +django-redis==5.2.0 django-sass-processor==1.2.2 -django-csp==3.7 +django-storages==1.13.2 +django-storages[azure] environs==9.5.0 flower==1.2.0 libsass==0.22.0 Markdown==3.4.1 -Pillow==10.0.1 -psycopg2==2.9.5 -pycryptodome==3.19.1 -python-dateutil==2.8.2 -redis==4.5.4 -requests==2.31.0 -responses==0.22.0 -pytz>=2022.7 -boto3==1.26.57 -django-storages==1.13.2 -django-storages[azure] -django-redis==5.2.0 opentelemetry-api==1.16.0 opentelemetry-exporter-otlp-proto-grpc==1.16.0 opentelemetry-instrumentation-celery==0.37b0 opentelemetry-instrumentation-django==0.37b0 opentelemetry-instrumentation-psycopg2==0.37b0 opentelemetry-sdk==1.16.0 +Pillow==10.0.1 protobuf==3.20.* +psycopg2==2.9.5 +pycryptodome==3.19.1 pyotp==2.8.0 +python-dateutil==2.8.2 +pytz>=2022.7 qrcode==7.3.1 +redis==4.5.4 +requests==2.31.0 +responses==0.22.0 # Dev -pytest-django==4.1.0 +celery-types==0.18.0 +django-stubs[compatible-mypy]==4.2.4 +mypy==1.5.1 +pylint==2.14.0 pytest==6.1.2 pytest-cov==2.10.1 +pytest-django==4.1.0 pytest-env==0.6.2 pytest-xdist==2.3.0 pytidylib==0.3.2 -pylint==2.14.0 -mypy==1.5.1 -celery-types==0.18.0 -django-stubs[compatible-mypy]==4.2.4 types-bleach==6.0.0.4 types-dataclasses==0.6.6 types-Markdown==3.4.2.10 From 570017d3b08a700a7cd12c656a5eeeff059b466b Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 15:57:06 -0800 Subject: [PATCH 03/17] Upgrade Python Version from 3.9 to 3.11 --- .github/workflows/django-tests.yml | 2 +- .github/workflows/mypy.yml | 4 ++-- .github/workflows/pylint.yml | 4 ++-- Dockerfile | 2 +- dev-tools/Dockerfile | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml index 78b6e142e..de71d9bcf 100644 --- a/.github/workflows/django-tests.yml +++ b/.github/workflows/django-tests.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install Dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 1a641edd2..6df987aa4 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install Dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 3811c97d3..ab8633b48 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install Dependencies run: | python -m pip install --upgrade pip diff --git a/Dockerfile b/Dockerfile index b3cd26e88..82b0c92c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9 +FROM python:3.11 ENV PYTHONUNBUFFERED 1 diff --git a/dev-tools/Dockerfile b/dev-tools/Dockerfile index 6c132944f..563467f09 100644 --- a/dev-tools/Dockerfile +++ b/dev-tools/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-bookworm +FROM python:3.11-bookworm WORKDIR /app/dev-tools ENV PATH="/app/dev-tools/node_modules/.bin:$PATH" From 39da471f795fd99e40f68e0f48c831f56864208a Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 15:59:17 -0800 Subject: [PATCH 04/17] Disable Pylint Failure for imghdr deprecation for now --- bookwyrm/connectors/abstract_connector.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bookwyrm/connectors/abstract_connector.py b/bookwyrm/connectors/abstract_connector.py index 8b6dcb885..b61bc2b04 100644 --- a/bookwyrm/connectors/abstract_connector.py +++ b/bookwyrm/connectors/abstract_connector.py @@ -3,7 +3,9 @@ from __future__ import annotations from abc import ABC, abstractmethod from typing import Optional, TypedDict, Any, Callable, Union, Iterator from urllib.parse import quote_plus -import imghdr + +# pylint: disable-next=deprecated-module +import imghdr # Deprecated in 3.11 for removal in 3.13; no good alternative yet import logging import re import asyncio From 4312e9bba02df710ca0f11f40fffe00ef7af95b8 Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:03:19 -0800 Subject: [PATCH 05/17] Upgrade Celery to 5.3.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f41210aea..0cfa9db9c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ aiohttp==3.9.2 bleach==5.0.1 boto3==1.26.57 bw-file-resubmit==0.6.0rc2 -celery==5.2.7 +celery==5.3.1 colorthief==0.2.1 Django==3.2.24 django-celery-beat==2.4.0 From c944824ac7abb6233b43a0f4cc573343635d287e Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:04:06 -0800 Subject: [PATCH 06/17] Upgrade django-celery-beat to 2.5.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0cfa9db9c..19f13307f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ bw-file-resubmit==0.6.0rc2 celery==5.3.1 colorthief==0.2.1 Django==3.2.24 -django-celery-beat==2.4.0 +django-celery-beat==2.5.0 django-compressor==4.3.1 django-csp==3.7 django-imagekit==4.1.0 From fee3fdd5a804a7cb3b234763649034b01b4f5d87 Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:04:37 -0800 Subject: [PATCH 07/17] Upgrade django-compressor to 4.4 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 19f13307f..5882607ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ celery==5.3.1 colorthief==0.2.1 Django==3.2.24 django-celery-beat==2.5.0 -django-compressor==4.3.1 +django-compressor==4.4 django-csp==3.7 django-imagekit==4.1.0 django-model-utils==4.3.1 From c1520da56d0959a5b56f272c2803120aae696425 Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:05:11 -0800 Subject: [PATCH 08/17] Upgrade flower to 2.0.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5882607ee..574c7811c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ django-sass-processor==1.2.2 django-storages==1.13.2 django-storages[azure] environs==9.5.0 -flower==1.2.0 +flower==2.0.0 libsass==0.22.0 Markdown==3.4.1 opentelemetry-api==1.16.0 From da2636fa294eec47502666e21dc41e4f71c66b4c Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:07:50 -0800 Subject: [PATCH 09/17] Add grpcio pin @ 1.57.0 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 574c7811c..076456b0d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,6 +16,7 @@ django-storages==1.13.2 django-storages[azure] environs==9.5.0 flower==2.0.0 +grpcio=1.57.0 # Not a direct dependency, pinned to get a security fix libsass==0.22.0 Markdown==3.4.1 opentelemetry-api==1.16.0 From 0f5a3e9163a3f52843b222668dd7a273014db500 Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:08:41 -0800 Subject: [PATCH 10/17] Pin Tornado at 6.3.3 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 076456b0d..05c606a83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,6 +36,7 @@ qrcode==7.3.1 redis==4.5.4 requests==2.31.0 responses==0.22.0 +tornado==6.3.3 # Not a direct dependency, pinned to get a security fix # Dev celery-types==0.18.0 From 498dc35d995793a73b3ae358a3d1f2d969240684 Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:09:06 -0800 Subject: [PATCH 11/17] Upgrade Pylint to 2.15.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 05c606a83..a2f95c6bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -42,7 +42,7 @@ tornado==6.3.3 # Not a direct dependency, pinned to get a security fix celery-types==0.18.0 django-stubs[compatible-mypy]==4.2.4 mypy==1.5.1 -pylint==2.14.0 +pylint==2.15.0 pytest==6.1.2 pytest-cov==2.10.1 pytest-django==4.1.0 From 22c4155c7c4b850c538ce26a5590d02acc4d706b Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 16:09:34 -0800 Subject: [PATCH 12/17] Upgrade pytest to 6.2.5 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a2f95c6bc..ae73b1d61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,7 +43,7 @@ celery-types==0.18.0 django-stubs[compatible-mypy]==4.2.4 mypy==1.5.1 pylint==2.15.0 -pytest==6.1.2 +pytest==6.2.5 pytest-cov==2.10.1 pytest-django==4.1.0 pytest-env==0.6.2 From be140d5e5a5818b73c40c7259a54a510681789db Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 17:20:48 -0800 Subject: [PATCH 13/17] Pin setuptools at 65.5.1 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index ae73b1d61..bdf84f7e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,6 +36,7 @@ qrcode==7.3.1 redis==4.5.4 requests==2.31.0 responses==0.22.0 +setuptools>=65.5.1 # Not a direct dependency, pinned to get a security fix tornado==6.3.3 # Not a direct dependency, pinned to get a security fix # Dev From eadb0e640f84f9a69c39638ce425e78fadffb594 Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 17:29:42 -0800 Subject: [PATCH 14/17] Fix typo in operator --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index bdf84f7e7..c769916a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ django-storages==1.13.2 django-storages[azure] environs==9.5.0 flower==2.0.0 -grpcio=1.57.0 # Not a direct dependency, pinned to get a security fix +grpcio==1.57.0 # Not a direct dependency, pinned to get a security fix libsass==0.22.0 Markdown==3.4.1 opentelemetry-api==1.16.0 From 9fa09d5ebeb96a379f1ba6765aaf22324b8f631d Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 17:30:37 -0800 Subject: [PATCH 15/17] Add extra space required by linter --- bookwyrm/connectors/abstract_connector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/connectors/abstract_connector.py b/bookwyrm/connectors/abstract_connector.py index b61bc2b04..fbf0fb31b 100644 --- a/bookwyrm/connectors/abstract_connector.py +++ b/bookwyrm/connectors/abstract_connector.py @@ -5,7 +5,7 @@ from typing import Optional, TypedDict, Any, Callable, Union, Iterator from urllib.parse import quote_plus # pylint: disable-next=deprecated-module -import imghdr # Deprecated in 3.11 for removal in 3.13; no good alternative yet +import imghdr # Deprecated in 3.11 for removal in 3.13; no good alternative yet import logging import re import asyncio From 91fe4ad535fbe4717042c3189d38d7b4c1336f4a Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 17:31:16 -0800 Subject: [PATCH 16/17] Fix spacing for linter --- bookwyrm/connectors/abstract_connector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/connectors/abstract_connector.py b/bookwyrm/connectors/abstract_connector.py index fbf0fb31b..aa8edbeae 100644 --- a/bookwyrm/connectors/abstract_connector.py +++ b/bookwyrm/connectors/abstract_connector.py @@ -5,7 +5,7 @@ from typing import Optional, TypedDict, Any, Callable, Union, Iterator from urllib.parse import quote_plus # pylint: disable-next=deprecated-module -import imghdr # Deprecated in 3.11 for removal in 3.13; no good alternative yet +import imghdr # Deprecated in 3.11 for removal in 3.13; no good alternative yet import logging import re import asyncio From d138395c75a6790f6ad81a727ad8a3f2c8b1169d Mon Sep 17 00:00:00 2001 From: Margaret Fero Date: Sat, 2 Mar 2024 17:43:49 -0800 Subject: [PATCH 17/17] Add linter exclusion for TBookWyrmModel --- bookwyrm/activitypub/base_activity.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bookwyrm/activitypub/base_activity.py b/bookwyrm/activitypub/base_activity.py index 890d4d24a..efc9d8da2 100644 --- a/bookwyrm/activitypub/base_activity.py +++ b/bookwyrm/activitypub/base_activity.py @@ -20,6 +20,7 @@ from bookwyrm.tasks import app, MISC logger = logging.getLogger(__name__) +# pylint: disable=invalid-name TBookWyrmModel = TypeVar("TBookWyrmModel", bound=base_model.BookWyrmModel)