Skip to content

Commit f81e120

Browse files
chore(deps): upgrade psycopg packages to version 3.3.0 (#8222)
* chore(deps): upgrade psycopg packages to version 3.3.0 * chore: update Python version to 3.12.x in CI workflow * refactor: clean up imports and improve code formatting across multiple files
1 parent 85d9003 commit f81e120

File tree

9 files changed

+47
-87
lines changed

9 files changed

+47
-87
lines changed

.github/workflows/pull-request-build-lint-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Set up Python
3232
uses: actions/setup-python@v5
3333
with:
34-
python-version: "3.x"
34+
python-version: "3.12.x"
3535
- name: Install Pylint
3636
run: python -m pip install ruff
3737
- name: Install API Dependencies

apps/api/plane/api/urls/member.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from django.urls import path
22

3-
from plane.api.views import ProjectMemberListCreateAPIEndpoint, ProjectMemberDetailAPIEndpoint, WorkspaceMemberAPIEndpoint
3+
from plane.api.views import (
4+
ProjectMemberListCreateAPIEndpoint,
5+
ProjectMemberDetailAPIEndpoint,
6+
WorkspaceMemberAPIEndpoint,
7+
)
48

59
urlpatterns = [
610
# Project members

apps/api/plane/api/views/base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from rest_framework import status
1414
from rest_framework.permissions import IsAuthenticated
1515
from rest_framework.response import Response
16-
from django_filters.rest_framework import DjangoFilterBackend
17-
from rest_framework.filters import SearchFilter
1816
from rest_framework.viewsets import ModelViewSet
1917
from rest_framework.exceptions import APIException
2018
from rest_framework.generics import GenericAPIView

apps/api/plane/api/views/module.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@
6565
ADMIN_ONLY_RESPONSE,
6666
REQUIRED_FIELDS_RESPONSE,
6767
MODULE_ISSUE_NOT_FOUND_RESPONSE,
68-
ARCHIVED_RESPONSE,
6968
CANNOT_ARCHIVE_RESPONSE,
70-
UNARCHIVED_RESPONSE,
7169
)
7270

7371

apps/api/plane/app/views/search/base.py

Lines changed: 26 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ def filter_cycles(self, query, slug, project_id, workspace_search):
129129
return (
130130
cycles.order_by("-created_at")
131131
.distinct()
132-
.values(
133-
"name", "id", "project_id", "project__identifier", "workspace__slug"
134-
)
132+
.values("name", "id", "project_id", "project__identifier", "workspace__slug")
135133
)
136134

137135
def filter_modules(self, query, slug, project_id, workspace_search):
@@ -155,9 +153,7 @@ def filter_modules(self, query, slug, project_id, workspace_search):
155153
return (
156154
modules.order_by("-created_at")
157155
.distinct()
158-
.values(
159-
"name", "id", "project_id", "project__identifier", "workspace__slug"
160-
)
156+
.values("name", "id", "project_id", "project__identifier", "workspace__slug")
161157
)
162158

163159
def filter_pages(self, query, slug, project_id, workspace_search):
@@ -177,9 +173,7 @@ def filter_pages(self, query, slug, project_id, workspace_search):
177173
)
178174
.annotate(
179175
project_ids=Coalesce(
180-
ArrayAgg(
181-
"projects__id", distinct=True, filter=~Q(projects__id=True)
182-
),
176+
ArrayAgg("projects__id", distinct=True, filter=~Q(projects__id=True)),
183177
Value([], output_field=ArrayField(UUIDField())),
184178
)
185179
)
@@ -196,20 +190,16 @@ def filter_pages(self, query, slug, project_id, workspace_search):
196190
)
197191

198192
if workspace_search == "false" and project_id:
199-
project_subquery = ProjectPage.objects.filter(
200-
page_id=OuterRef("id"), project_id=project_id
201-
).values_list("project_id", flat=True)[:1]
193+
project_subquery = ProjectPage.objects.filter(page_id=OuterRef("id"), project_id=project_id).values_list(
194+
"project_id", flat=True
195+
)[:1]
202196

203-
pages = pages.annotate(project_id=Subquery(project_subquery)).filter(
204-
project_id=project_id
205-
)
197+
pages = pages.annotate(project_id=Subquery(project_subquery)).filter(project_id=project_id)
206198

207199
return (
208200
pages.order_by("-created_at")
209201
.distinct()
210-
.values(
211-
"name", "id", "project_ids", "project_identifiers", "workspace__slug"
212-
)
202+
.values("name", "id", "project_ids", "project_identifiers", "workspace__slug")
213203
)
214204

215205
def filter_views(self, query, slug, project_id, workspace_search):
@@ -233,9 +223,7 @@ def filter_views(self, query, slug, project_id, workspace_search):
233223
return (
234224
issue_views.order_by("-created_at")
235225
.distinct()
236-
.values(
237-
"name", "id", "project_id", "project__identifier", "workspace__slug"
238-
)
226+
.values("name", "id", "project_id", "project__identifier", "workspace__slug")
239227
)
240228

241229
def filter_intakes(self, query, slug, project_id, workspace_search):
@@ -294,9 +282,7 @@ def get(self, request, slug):
294282

295283
# Determine which entities to search
296284
if entities_param:
297-
requested_entities = [
298-
e.strip() for e in entities_param.split(",") if e.strip()
299-
]
285+
requested_entities = [e.strip() for e in entities_param.split(",") if e.strip()]
300286
requested_entities = [e for e in requested_entities if e in MODELS_MAPPER]
301287
else:
302288
requested_entities = list(MODELS_MAPPER.keys())
@@ -306,9 +292,7 @@ def get(self, request, slug):
306292
for entity in requested_entities:
307293
func = MODELS_MAPPER.get(entity)
308294
if func:
309-
results[entity] = func(
310-
query or None, slug, project_id, workspace_search
311-
)
295+
results[entity] = func(query or None, slug, project_id, workspace_search)
312296

313297
return Response({"results": results}, status=status.HTTP_200_OK)
314298

@@ -320,7 +304,6 @@ def get(self, request, slug):
320304
query_types = [qt.strip() for qt in query_types]
321305
count = int(request.query_params.get("count", 5))
322306
project_id = request.query_params.get("project_id", None)
323-
issue_id = request.query_params.get("issue_id", None)
324307

325308
response_data = {}
326309

@@ -367,14 +350,10 @@ def get(self, request, slug):
367350
.order_by("-created_at")
368351
)
369352

370-
users = (
371-
users
372-
.distinct()
373-
.values(
374-
"member__avatar_url",
375-
"member__display_name",
376-
"member__id",
377-
)
353+
users = users.distinct().values(
354+
"member__avatar_url",
355+
"member__display_name",
356+
"member__id",
378357
)
379358

380359
response_data["user_mention"] = list(users[:count])
@@ -389,15 +368,12 @@ def get(self, request, slug):
389368
projects = (
390369
Project.objects.filter(
391370
q,
392-
Q(project_projectmember__member=self.request.user)
393-
| Q(network=2),
371+
Q(project_projectmember__member=self.request.user) | Q(network=2),
394372
workspace__slug=slug,
395373
)
396374
.order_by("-created_at")
397375
.distinct()
398-
.values(
399-
"name", "id", "identifier", "logo_props", "workspace__slug"
400-
)[:count]
376+
.values("name", "id", "identifier", "logo_props", "workspace__slug")[:count]
401377
)
402378
response_data["project"] = list(projects)
403379

@@ -456,20 +432,16 @@ def get(self, request, slug):
456432
.annotate(
457433
status=Case(
458434
When(
459-
Q(start_date__lte=timezone.now())
460-
& Q(end_date__gte=timezone.now()),
435+
Q(start_date__lte=timezone.now()) & Q(end_date__gte=timezone.now()),
461436
then=Value("CURRENT"),
462437
),
463438
When(
464439
start_date__gt=timezone.now(),
465440
then=Value("UPCOMING"),
466441
),
442+
When(end_date__lt=timezone.now(), then=Value("COMPLETED")),
467443
When(
468-
end_date__lt=timezone.now(), then=Value("COMPLETED")
469-
),
470-
When(
471-
Q(start_date__isnull=True)
472-
& Q(end_date__isnull=True),
444+
Q(start_date__isnull=True) & Q(end_date__isnull=True),
473445
then=Value("DRAFT"),
474446
),
475447
default=Value("DRAFT"),
@@ -587,9 +559,7 @@ def get(self, request, slug):
587559
)
588560
)
589561
.order_by("-created_at")
590-
.values(
591-
"member__avatar_url", "member__display_name", "member__id"
592-
)[:count]
562+
.values("member__avatar_url", "member__display_name", "member__id")[:count]
593563
)
594564
response_data["user_mention"] = list(users)
595565

@@ -603,15 +573,12 @@ def get(self, request, slug):
603573
projects = (
604574
Project.objects.filter(
605575
q,
606-
Q(project_projectmember__member=self.request.user)
607-
| Q(network=2),
576+
Q(project_projectmember__member=self.request.user) | Q(network=2),
608577
workspace__slug=slug,
609578
)
610579
.order_by("-created_at")
611580
.distinct()
612-
.values(
613-
"name", "id", "identifier", "logo_props", "workspace__slug"
614-
)[:count]
581+
.values("name", "id", "identifier", "logo_props", "workspace__slug")[:count]
615582
)
616583
response_data["project"] = list(projects)
617584

@@ -668,20 +635,16 @@ def get(self, request, slug):
668635
.annotate(
669636
status=Case(
670637
When(
671-
Q(start_date__lte=timezone.now())
672-
& Q(end_date__gte=timezone.now()),
638+
Q(start_date__lte=timezone.now()) & Q(end_date__gte=timezone.now()),
673639
then=Value("CURRENT"),
674640
),
675641
When(
676642
start_date__gt=timezone.now(),
677643
then=Value("UPCOMING"),
678644
),
645+
When(end_date__lt=timezone.now(), then=Value("COMPLETED")),
679646
When(
680-
end_date__lt=timezone.now(), then=Value("COMPLETED")
681-
),
682-
When(
683-
Q(start_date__isnull=True)
684-
& Q(end_date__isnull=True),
647+
Q(start_date__isnull=True) & Q(end_date__isnull=True),
685648
then=Value("DRAFT"),
686649
),
687650
default=Value("DRAFT"),

apps/api/plane/app/views/user/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def update_email(self, request):
210210
status=status.HTTP_400_BAD_REQUEST,
211211
)
212212

213-
except Exception as e:
213+
except Exception:
214214
return Response(
215215
{"error": "Failed to verify code. Please try again."},
216216
status=status.HTTP_400_BAD_REQUEST,

apps/api/plane/bgtasks/export_task.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import io
33
import zipfile
44
from typing import List
5-
from collections import defaultdict
65
import boto3
76
from botocore.client import Config
87
from uuid import UUID

apps/api/plane/tests/contract/api/test_cycles.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import pytest
22
from rest_framework import status
3-
from django.db import IntegrityError
43
from django.utils import timezone
5-
from datetime import datetime, timedelta
4+
from datetime import timedelta
65
from uuid import uuid4
76

87
from plane.db.models import Cycle, Project, ProjectMember
@@ -58,8 +57,6 @@ def create_cycle(db, project, create_user):
5857
)
5958

6059

61-
62-
6360
@pytest.mark.contract
6461
class TestCycleListCreateAPIEndpoint:
6562
"""Test Cycle List and Create API Endpoint"""
@@ -85,7 +82,6 @@ def test_create_cycle_success(self, api_key_client, workspace, project, cycle_da
8582
assert created_cycle.project == project
8683
assert created_cycle.owned_by_id is not None
8784

88-
8985
@pytest.mark.django_db
9086
def test_create_cycle_invalid_data(self, api_key_client, workspace, project):
9187
"""Test cycle creation with invalid data"""
@@ -197,7 +193,7 @@ def test_list_cycles_with_view_filter(self, api_key_client, workspace, project,
197193

198194
# Create cycles in different states
199195
now = timezone.now()
200-
196+
201197
# Current cycle (started but not ended)
202198
Cycle.objects.create(
203199
name="Current Cycle",
@@ -207,7 +203,7 @@ def test_list_cycles_with_view_filter(self, api_key_client, workspace, project,
207203
end_date=now + timedelta(days=6),
208204
owned_by=create_user,
209205
)
210-
206+
211207
# Upcoming cycle
212208
Cycle.objects.create(
213209
name="Upcoming Cycle",
@@ -217,7 +213,7 @@ def test_list_cycles_with_view_filter(self, api_key_client, workspace, project,
217213
end_date=now + timedelta(days=8),
218214
owned_by=create_user,
219215
)
220-
216+
221217
# Completed cycle
222218
Cycle.objects.create(
223219
name="Completed Cycle",
@@ -227,7 +223,7 @@ def test_list_cycles_with_view_filter(self, api_key_client, workspace, project,
227223
end_date=now - timedelta(days=3),
228224
owned_by=create_user,
229225
)
230-
226+
231227
# Draft cycle
232228
Cycle.objects.create(
233229
name="Draft Cycle",
@@ -320,7 +316,9 @@ def test_update_cycle_invalid_data(self, api_key_client, workspace, project, cre
320316
assert response.status_code in [status.HTTP_400_BAD_REQUEST, status.HTTP_200_OK]
321317

322318
@pytest.mark.django_db
323-
def test_update_cycle_with_external_id_conflict(self, api_key_client, workspace, project, create_cycle, create_user ):
319+
def test_update_cycle_with_external_id_conflict(
320+
self, api_key_client, workspace, project, create_cycle, create_user
321+
):
324322
"""Test cycle update with conflicting external ID"""
325323
url = self.get_cycle_detail_url(workspace.slug, project.id, create_cycle.id)
326324

@@ -363,7 +361,7 @@ def test_cycle_metrics_annotation(self, api_key_client, workspace, project, crea
363361
response = api_key_client.get(url)
364362

365363
assert response.status_code == status.HTTP_200_OK
366-
364+
367365
# Check that metrics are included in response
368366
cycle_data = response.data
369367
assert "total_issues" in cycle_data
@@ -372,11 +370,11 @@ def test_cycle_metrics_annotation(self, api_key_client, workspace, project, crea
372370
assert "started_issues" in cycle_data
373371
assert "unstarted_issues" in cycle_data
374372
assert "backlog_issues" in cycle_data
375-
373+
376374
# All should be 0 for a new cycle
377375
assert cycle_data["total_issues"] == 0
378376
assert cycle_data["completed_issues"] == 0
379377
assert cycle_data["cancelled_issues"] == 0
380378
assert cycle_data["started_issues"] == 0
381379
assert cycle_data["unstarted_issues"] == 0
382-
assert cycle_data["backlog_issues"] == 0
380+
assert cycle_data["backlog_issues"] == 0

apps/api/requirements/base.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Django==4.2.27
55
# rest framework
66
djangorestframework==3.15.2
77
# postgres
8-
psycopg==3.2.9
9-
psycopg-binary==3.2.9
10-
psycopg-c==3.2.9
8+
psycopg==3.3.0
9+
psycopg-binary==3.3.0
10+
psycopg-c==3.3.0
1111
dj-database-url==2.1.0
1212
# mongo
1313
pymongo==4.6.3

0 commit comments

Comments
 (0)