From 54527ecd5dea63f65cd0bcf40a706b847bca4398 Mon Sep 17 00:00:00 2001
From: Erwan Rouchet <rouchet@teklia.com>
Date: Wed, 12 Feb 2025 16:39:48 +0100
Subject: [PATCH 1/3] Switch to Python 3.12

---
 .gitlab-ci.yml                        | 6 +++---
 Dockerfile                            | 4 ++--
 arkindex/documents/export/__init__.py | 2 +-
 arkindex/project/checks.py            | 4 ++--
 arkindex/project/tests/test_checks.py | 8 ++++----
 base/Dockerfile                       | 2 +-
 base/requirements.txt                 | 7 +++----
 requirements.txt                      | 6 ++----
 setup.py                              | 2 +-
 9 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6183a928f0..571548691a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,7 +11,7 @@ include:
 
 # For jobs that run backend scripts directly
 .backend-setup:
-  image: registry.gitlab.teklia.com/arkindex/backend/base:psycopg3
+  image: registry.gitlab.teklia.com/arkindex/backend/base:python3.12
 
   cache:
     paths:
@@ -61,7 +61,7 @@ backend-tests:
     - arkindex test
 
 backend-lint:
-  image: python:3.10
+  image: python:3.12
   stage: test
 
   except:
@@ -159,7 +159,7 @@ backend-build:
 backend-build-binary:
   stage: build
 
-  image: python:3.10
+  image: python:3.12
 
   before_script:
     - pip install nuitka
diff --git a/Dockerfile b/Dockerfile
index b1092bf632..9ebc012df1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,11 @@
 # syntax=docker/dockerfile:1
-FROM registry.gitlab.teklia.com/arkindex/backend/base:psycopg3 AS build
+FROM registry.gitlab.teklia.com/arkindex/backend/base:python3.12 AS build
 
 RUN mkdir build
 ADD . build
 RUN cd build && python3 setup.py sdist
 
-FROM registry.gitlab.teklia.com/arkindex/backend/base:psycopg3
+FROM registry.gitlab.teklia.com/arkindex/backend/base:python3.12
 
 # Install arkindex and its deps
 # Uses a source archive instead of full local copy to speedup docker build
diff --git a/arkindex/documents/export/__init__.py b/arkindex/documents/export/__init__.py
index bd51e010f4..cdf88ee5ec 100644
--- a/arkindex/documents/export/__init__.py
+++ b/arkindex/documents/export/__init__.py
@@ -86,7 +86,7 @@ def save_sqlite(rows, table, cursor):
             return float(value)
 
         # Show very explicit error messages if we stumble upon an unexpected type
-        # https://docs.python.org/3.10/library/sqlite3.html#sqlite-and-python-types
+        # https://docs.python.org/3.12/library/sqlite3.html#sqlite-and-python-types
         assert value is None or isinstance(value, (int, float, str, bytes)), f"Type {type(value)} is not supported by sqlite3"
 
         return value
diff --git a/arkindex/project/checks.py b/arkindex/project/checks.py
index c9eebd2ba0..d16a8cbb48 100644
--- a/arkindex/project/checks.py
+++ b/arkindex/project/checks.py
@@ -148,10 +148,10 @@ def public_hostname_check(*args, **kwargs):
 
 @register()
 def python_version_check(*args, **kwargs):
-    if sys.version_info.minor < 10:
+    if sys.version_info.minor < 12:
         return [
             Critical(
-                "Arkindex requires Python 3.10 or later.",
+                "Arkindex requires Python 3.12 or later.",
                 id="arkindex.C001",
             )
         ]
diff --git a/arkindex/project/tests/test_checks.py b/arkindex/project/tests/test_checks.py
index 4addeb993e..92fc424748 100644
--- a/arkindex/project/tests/test_checks.py
+++ b/arkindex/project/tests/test_checks.py
@@ -154,18 +154,18 @@ class ChecksTestCase(TestCase):
     def test_python_version_check(self, version_info_mock):
         from arkindex.project.checks import python_version_check
 
-        version_info_mock.minor = 9
+        version_info_mock.minor = 11
         self.assertListEqual(python_version_check(), [
             Critical(
-                "Arkindex requires Python 3.10 or later.",
+                "Arkindex requires Python 3.12 or later.",
                 id="arkindex.C001",
             )
         ])
 
-        version_info_mock.minor = 10
+        version_info_mock.minor = 12
         self.assertListEqual(python_version_check(), [])
 
-        version_info_mock.minor = 11
+        version_info_mock.minor = 13
         self.assertListEqual(python_version_check(), [])
 
     @override_settings()
diff --git a/base/Dockerfile b/base/Dockerfile
index 5bf809476c..1efe60a29f 100644
--- a/base/Dockerfile
+++ b/base/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.10-slim-bookworm
+FROM python:3.12-slim-bookworm
 
 # Install some runtime deps and python dependencies that are slow to install or require specific build deps
 ADD requirements.txt bootstrap.sh /
diff --git a/base/requirements.txt b/base/requirements.txt
index 1ff54d70b0..6617e7bfc6 100644
--- a/base/requirements.txt
+++ b/base/requirements.txt
@@ -1,5 +1,4 @@
-boto3==1.18.13
-cryptography==3.4.7
+boto3==1.36.16
+cryptography==44.0.1
 Django==5.0.8
-ed25519==1.5
-lxml==4.9.2
+lxml==5.3.1
diff --git a/requirements.txt b/requirements.txt
index 811e308e35..0deadcac3b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,5 @@
 # -r ./base/requirements.txt
 
-
 bleach==6.0.0
 django-admin-hstore-widget==1.2.1
 django-cors-headers==3.14.0
@@ -8,13 +7,12 @@ django-enumfields2==3.0.2
 django-pgtrigger==4.7.0
 django-rq==2.10.1
 djangorestframework==3.15.2
-djangorestframework-simplejwt==5.2.2
+djangorestframework-simplejwt==5.4.0
 docker==7.0.0
 drf-spectacular==0.27.2
 psycopg[binary]==3.2.4
 python-magic==0.4.27
 python-memcached==1.59
-PyYAML==6.0
 requests==2.28.2
 rq==1.16.0
 sentry-sdk==2.7.1
@@ -23,4 +21,4 @@ SolrClient==0.3.1
 teklia-toolbox==0.1.3
 tenacity==8.2.2
 uritemplate==4.1.1
-zstandard==0.20.0
+zstandard==0.23.0
diff --git a/setup.py b/setup.py
index fdd40bb80d..6fdd438653 100755
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,7 @@ setup(
     author="Teklia",
     author_email="abadie@teklia.com",
     url="https://arkindex.teklia.com",
-    python_requires=">=3.10",
+    python_requires=">=3.12",
     install_requires=install_requires,
     test_suite="arkindex.project.runtests.run",
     tests_require=tests_requires,
-- 
GitLab


From 31cab657c9c713583f51f6ad1f768fe882b2d464 Mon Sep 17 00:00:00 2001
From: Erwan Rouchet <rouchet@teklia.com>
Date: Thu, 13 Feb 2025 11:35:44 +0100
Subject: [PATCH 2/3] Remove a dependency that we no longer need since 2021

---
 base/requirements.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/base/requirements.txt b/base/requirements.txt
index 6617e7bfc6..691940d4e5 100644
--- a/base/requirements.txt
+++ b/base/requirements.txt
@@ -1,4 +1,3 @@
 boto3==1.36.16
 cryptography==44.0.1
 Django==5.0.8
-lxml==5.3.1
-- 
GitLab


From e4089c6d257ce081f115c702101ac96deea30e1e Mon Sep 17 00:00:00 2001
From: Erwan Rouchet <rouchet@teklia.com>
Date: Thu, 13 Feb 2025 11:37:20 +0100
Subject: [PATCH 3/3] Loosen Python version requirement

---
 arkindex/project/checks.py            | 4 ++--
 arkindex/project/tests/test_checks.py | 8 ++++----
 setup.py                              | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arkindex/project/checks.py b/arkindex/project/checks.py
index d16a8cbb48..c9eebd2ba0 100644
--- a/arkindex/project/checks.py
+++ b/arkindex/project/checks.py
@@ -148,10 +148,10 @@ def public_hostname_check(*args, **kwargs):
 
 @register()
 def python_version_check(*args, **kwargs):
-    if sys.version_info.minor < 12:
+    if sys.version_info.minor < 10:
         return [
             Critical(
-                "Arkindex requires Python 3.12 or later.",
+                "Arkindex requires Python 3.10 or later.",
                 id="arkindex.C001",
             )
         ]
diff --git a/arkindex/project/tests/test_checks.py b/arkindex/project/tests/test_checks.py
index 92fc424748..4addeb993e 100644
--- a/arkindex/project/tests/test_checks.py
+++ b/arkindex/project/tests/test_checks.py
@@ -154,18 +154,18 @@ class ChecksTestCase(TestCase):
     def test_python_version_check(self, version_info_mock):
         from arkindex.project.checks import python_version_check
 
-        version_info_mock.minor = 11
+        version_info_mock.minor = 9
         self.assertListEqual(python_version_check(), [
             Critical(
-                "Arkindex requires Python 3.12 or later.",
+                "Arkindex requires Python 3.10 or later.",
                 id="arkindex.C001",
             )
         ])
 
-        version_info_mock.minor = 12
+        version_info_mock.minor = 10
         self.assertListEqual(python_version_check(), [])
 
-        version_info_mock.minor = 13
+        version_info_mock.minor = 11
         self.assertListEqual(python_version_check(), [])
 
     @override_settings()
diff --git a/setup.py b/setup.py
index 6fdd438653..6dce684b6c 100755
--- a/setup.py
+++ b/setup.py
@@ -30,9 +30,9 @@ setup(
     license_files=("LICENSE",),
     description="Manuscripts indexation framework",
     author="Teklia",
-    author_email="abadie@teklia.com",
+    author_email="contact@teklia.com",
     url="https://arkindex.teklia.com",
-    python_requires=">=3.12",
+    python_requires=">=3.10",
     install_requires=install_requires,
     test_suite="arkindex.project.runtests.run",
     tests_require=tests_requires,
-- 
GitLab