Skip to content

Commit a632fee

Browse files
committed
deps: upgrade to python 3.12
Switches the base image to ubi9 with Python 3.12 image and ditches the psycopg2 in favor of psycopg-c (3.x.x). Upgrades local dev database to Postgres 17 to be inline databases used in envs. Refs: ATV-242
1 parent f9cc750 commit a632fee

10 files changed

Lines changed: 23 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ jobs:
1212
uses: City-of-Helsinki/.github/.github/workflows/ci-django-api.yml@main
1313
secrets: inherit
1414
with:
15-
python-version: 3.11
16-
postgres-major-version: 14
15+
python-version: 3.12
16+
postgres-major-version: 17

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ==============================
2-
FROM registry.access.redhat.com/ubi8/python-311 AS appbase
2+
FROM registry.access.redhat.com/ubi9/python-312 AS appbase
33
# ==============================
44

55
EXPOSE 8000/tcp
@@ -28,7 +28,7 @@ COPY --chown=1000:0 requirements-prod.txt /app/requirements-prod.txt
2828
COPY --chown=1000:0 .prod/escape_json.c /app/.prod/escape_json.c
2929
USER 1000
3030

31-
RUN pip install -U pip \
31+
RUN pip install -U pip setuptools wheel \
3232
&& pip install --no-cache-dir -r /app/requirements.txt \
3333
&& pip install --no-cache-dir -r /app/requirements-prod.txt \
3434
&& uwsgi --build-plugin /app/.prod/escape_json.c \

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Prerequisites:
3939
## Development without Docker
4040

4141
Prerequisites:
42-
* PostgreSQL 14
43-
* Python 3.11
42+
* PostgreSQL 17
43+
* Python 3.12
4444

4545

4646
### Installing Python requirements

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
postgres:
3-
image: postgres:14
3+
image: postgres:17
44
restart: on-failure
55
environment:
66
POSTGRES_USER: atv

documents/tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_content_is_encrypted(service, user):
3333
with connection.cursor() as cur:
3434
cur.execute("SELECT content FROM %s" % Document._meta.db_table)
3535
row = cur.fetchone()
36-
assert "test_content" not in row[0]
36+
assert b"test_content" not in row[0]
3737

3838
data = field.decrypt(row[0])
3939
assert data == content

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.ruff]
2-
target-version = "py311"
2+
target-version = "py312"
33

44
[tool.ruff.lint]
55
select = [

requirements-dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.11
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pip-compile requirements-dev.in
@@ -101,9 +101,9 @@ traitlets==5.14.3
101101
# via
102102
# ipython
103103
# matplotlib-inline
104-
typing-extensions==4.12.2
104+
typing-extensions==4.15.0
105105
# via
106-
# ipython
106+
# -c requirements.txt
107107
# pytest-factoryboy
108108
virtualenv==20.26.6
109109
# via pre-commit

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ djangorestframework-api-key
1010
drf-extensions
1111
drf-oidc-auth==0.10.0
1212
drf-spectacular
13-
psycopg2
13+
psycopg[c]
1414
sentry_sdk
1515
elasticsearch==7.15.2
1616
pyclamd

requirements.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.11
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pip-compile requirements.in
@@ -32,6 +32,7 @@ django==4.2.23
3232
# django-helusers
3333
# django-searchable-encrypted-fields
3434
# djangorestframework
35+
# drf-extensions
3536
# drf-oidc-auth
3637
# drf-spectacular
3738
django-cors-headers==4.4.0
@@ -54,7 +55,7 @@ djangorestframework==3.15.2
5455
# drf-spectacular
5556
djangorestframework-api-key==3.0.0
5657
# via -r requirements.in
57-
drf-extensions==0.7.1
58+
drf-extensions==0.8.0
5859
# via -r requirements.in
5960
drf-oidc-auth==0.10.0
6061
# via -r requirements.in
@@ -80,8 +81,11 @@ packaging==24.1
8081
# via
8182
# deprecation
8283
# djangorestframework-api-key
83-
psycopg2==2.9.9
84+
# drf-extensions
85+
psycopg[c]==3.2.9
8486
# via -r requirements.in
87+
psycopg-c==3.2.9
88+
# via psycopg
8589
pyasn1==0.4.8
8690
# via
8791
# python-jose
@@ -120,6 +124,8 @@ six==1.16.0
120124
# pyjwkest
121125
sqlparse==0.5.1
122126
# via django
127+
typing-extensions==4.15.0
128+
# via psycopg
123129
uritemplate==4.1.1
124130
# via drf-spectacular
125131
urllib3==1.26.20

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sonar.projectKey=atv-api
22
sonar.organization=city-of-helsinki
3-
sonar.python.version=3.11
3+
sonar.python.version=3.12
44
sonar.python.coverage.reportPaths=coverage.xml
55
sonar.test.inclusions=**/tests/**/*
66
sonar.exclusions=**/tests/**/*,**/migrations/*,commitlint.config.mjs

0 commit comments

Comments
 (0)