Upgrade from psycopg2 to psycopg3; drop python <= v3.5, add v3.8-v3.11
authorKarl O. Pinc <kop@karlpinc.com>
Fri, 23 Feb 2024 16:22:21 +0000 (10:22 -0600)
committerKarl O. Pinc <kop@karlpinc.com>
Fri, 23 Feb 2024 16:22:21 +0000 (10:22 -0600)
setup.py
src/pgwui_bulk_upload/exceptions.py
src/pgwui_bulk_upload/views/bulk_upload.py
tox.ini

index a543cd234c6458552da9daebd293f30de675e27b..bff940f622c3d82c7c8fe1c735ed20b2721fa246 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -116,10 +116,12 @@ setup(
         # Specify the Python versions you support here. In particular, ensure
         # that you indicate whether you support Python 2, Python 3 or both.
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.4',
-        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
     ],
 
     # What does your project relate to?
index c34e24d9d4f94dda44bb7a90dfdf3ebb70010f6f..e19cf47795b369c5d4556f896a1ea43c9bf7a28a 100644 (file)
@@ -1,4 +1,5 @@
-# Copyright (C) 2020, 2021 The Meme Factory, Inc.  http://www.karlpinc.com/
+# Copyright (C) 2020, 2021, 2024 The Meme Factory, Inc.
+# http://www.karlpinc.com/
 
 # This file is part of PGWUI_Bulk_Upload.
 #
@@ -100,7 +101,7 @@ class CannotRollbackError(SetupError):
             'The transaction has failed and must roll back before '
             'the database can again be queried about relations and '
             'their columns',
-            f'The error from psycopg2 is: ({exp})')
+            f'The error from psycopg3 is: ({exp})')
 
 
 class BadMapFileError(SetupError):
index 02d3abc5fdc833006fdd0780deba9cb3cf80ad9e..ea7fdf372488a2e42b049cd9151290406bb9deea 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015, 2018, 2020, 2021 The Meme Factory, Inc.
+# Copyright (C) 2015, 2018, 2020, 2021, 2024 The Meme Factory, Inc.
 # http://www.karlpinc.com/
 
 # This file is part of PGWUI_Bulk_Upload.
@@ -25,7 +25,7 @@ import logging
 import os
 import os.path
 import pathlib
-import psycopg2
+import psycopg
 import tempfile
 import zipfile
 
@@ -98,7 +98,7 @@ class SaveBulkLine(DataLineProcessor, ParameterExecutor):
         ue             UploadEngine instance
         uh             UploadHandler instance
         insert_map     Dict mapping file to insert statement used to insert
-                       into db. (psycopg2 formatted for substituion)
+                       into db. (psycopg3 formatted for substituion)
         '''
         super().__init__(ue, uh)
         self.insert_map = insert_map
@@ -127,7 +127,7 @@ class SaveBulkLine(DataLineProcessor, ParameterExecutor):
                     error.color(map_description(filepath, relation),
                                 filepath, relation)
             raise exp
-        except psycopg2.DatabaseError as exp:
+        except psycopg.DatabaseError as exp:
             relation = data.relation
             raise core_ex.DBDataLineError(udl, exp).color(
                 map_description(filepath, relation),
@@ -605,7 +605,7 @@ class BulkTableUploadHandler(BaseTableUploadHandler):
                     # new transaction.
                     try:
                         self.cur.execute('ROLLBACK;')
-                    except psycopg2.DatabaseError as exp:
+                    except psycopg.DatabaseError as exp:
                         err = ex.CannotRollbackError(exp).color(
                             map_description(fileinfo.filepath,
                                             fileinfo.relation),
diff --git a/tox.ini b/tox.ini
index 3eae53d52c4ce4092a027241dd51f476ee746d37..deebab347ce2e741aedf6992579a12f0e1221999 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,12 +1,14 @@
 [tox]
-envlist = py{34,35,36,37}
+envlist = py{36,37,38,39,310,311}
 
 [testenv]
 basepython =
-    py34: python3.4
-    py35: python3.5
     py36: python3.6
     py37: python3.7
+    py38: python3.8
+    py39: python3.9
+    py310: python3.10
+    py311: python3.11
 deps =
     check-manifest
     cmarkgfm