From ea5e3c1837457e2f104b7e6634ec7125121855c5 Mon Sep 17 00:00:00 2001 From: Rasmus Handberg Date: Tue, 18 Apr 2023 11:46:46 +0200 Subject: [PATCH 1/7] Try to test with Python 3.11 --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 43bbb11..130c5ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,10 +58,10 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] - exclude: - - os: windows-latest - python-version: '3.10' + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + #exclude: + # - os: windows-latest + # python-version: '3.10' name: Python ${{ matrix.python-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} From f4868430ff88285ef5aa207809723b8dfef28c09 Mon Sep 17 00:00:00 2001 From: Rasmus Handberg Date: Tue, 18 Apr 2023 15:20:40 +0200 Subject: [PATCH 2/7] Remove Python 3.7 support --- .github/workflows/tests.yml | 2 +- photometry/tasoc_db.py | 15 ++++++++------- requirements.txt | 26 ++++++++++++-------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 130c5ec..933558a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,7 +58,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] #exclude: # - os: windows-latest # python-version: '3.10' diff --git a/photometry/tasoc_db.py b/photometry/tasoc_db.py index 25917eb..888fd17 100644 --- a/photometry/tasoc_db.py +++ b/photometry/tasoc_db.py @@ -12,8 +12,8 @@ .. codeauthor:: Rasmus Handberg """ -import psycopg2 as psql -from psycopg2.extras import DictCursor +import psycopg +from psycopg.rows import dict_row import getpass import contextlib import random @@ -24,8 +24,8 @@ class TASOC_DB(object): # pragma: no cover Connection to the central TASOC database. Attributes: - conn (`psycopg2.Connection` object): Connection to PostgreSQL database. - cursor (`psycopg2.Cursor` object): Cursor to use in database. + conn (:class:`psycopg.Connection`): Connection to PostgreSQL database. + cursor (:class:`psycopg.Cursor`): Cursor to use in database. """ def __init__(self, username=None, password=None): @@ -49,8 +49,9 @@ def __init__(self, username=None, password=None): password = getpass.getpass('Password: ') # Open database connection: - self.conn = psql.connect('host=10.28.0.127 user=' + username + ' password=' + password + ' dbname=db_aadc') - self.cursor = self.conn.cursor(cursor_factory=DictCursor) + self.conn = psycopg.connect('host=10.28.0.127 user=' + username + ' password=' + password + ' dbname=db_aadc', + autocommit=False) + self.cursor = self.conn.cursor(row_factory=dict_row) #---------------------------------------------------------------------------------------------- def close(self): @@ -69,6 +70,6 @@ def __exit__(self, *args, **kwargs): def named_cursor(self, name=None, itersize=2000): if name is None: name = 'tasocdb-{0:06d}'.format(random.randint(0, 999999)) - named_cursor = contextlib.closing(self.conn.cursor(name=name, cursor_factory=DictCursor)) + named_cursor = contextlib.closing(self.conn.cursor(name=name, row_factory=dict_row)) named_cursor.itersize = itersize return named_cursor diff --git a/requirements.txt b/requirements.txt index c683fc8..62c61b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,26 +5,24 @@ flake8 flake8-tabs >= 2.3.2 flake8-builtins flake8-logging-format -numpy == 1.21.6 -scipy == 1.7.3 -matplotlib == 3.5.2 -astropy == 5.1.0 ; python_version > '3.7' -astropy == 4.3.1 ; python_version <= '3.7' +numpy == 1.24.2 +scipy == 1.10.1 +matplotlib == 3.7.1 +astropy == 5.2.2 PyYAML -photutils == 1.3.0 -Bottleneck == 1.3.5 +photutils == 1.7.0 +Bottleneck == 1.3.7 h5py >= 3.7 -scikit-image == 0.19.2 -scikit-learn == 1.0.2 -statsmodels == 0.13.2 +scikit-image == 0.20.0 +scikit-learn == 1.2.2 +statsmodels == 0.13.5 opencv-python-headless == 4.5.5.64 -psycopg2-binary +psycopg requests >= 2.5 responses httpretty astroquery >= 0.4 # Needed for halophot -autograd == 1.4 # Needed for halophot -future == 0.16.0 # Needed for halophot +autograd >= 1.4 # Needed for halophot halophot == 0.7.6.1 jplephem >= 2.9 -spiceypy == 5.0.1 +spiceypy == 5.1.2 From fac758a21b331401a798d09868ae2c70cee75738 Mon Sep 17 00:00:00 2001 From: Rasmus Handberg Date: Tue, 18 Apr 2023 15:30:18 +0200 Subject: [PATCH 3/7] Pull back scipy because of scikit-image --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 62c61b2..5424ca4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ flake8-tabs >= 2.3.2 flake8-builtins flake8-logging-format numpy == 1.24.2 -scipy == 1.10.1 +scipy == 1.9.1 matplotlib == 3.7.1 astropy == 5.2.2 PyYAML From d15a2f24261c77c9e2a9d7d17f2c8097d86b646d Mon Sep 17 00:00:00 2001 From: Rasmus Handberg Date: Wed, 19 Apr 2023 16:16:26 +0200 Subject: [PATCH 4/7] Test fixed version of halophot NOTE: This is not to be used in production --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5424ca4..fc8fab7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,6 +23,7 @@ responses httpretty astroquery >= 0.4 # Needed for halophot autograd >= 1.4 # Needed for halophot -halophot == 0.7.6.1 +#halophot == 0.7.6.1 +git+https://github.com/rhandberg/halophot.git@fix-sklearn#egg=halophot jplephem >= 2.9 spiceypy == 5.1.2 From 9ab35dfe98b0d55a271761de1f18e486c3d6a28e Mon Sep 17 00:00:00 2001 From: Rasmus Handberg Date: Wed, 19 Apr 2023 17:08:26 +0200 Subject: [PATCH 5/7] Trying to get pip to fix dependency issues --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index fc8fab7..7d733cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,8 +5,8 @@ flake8 flake8-tabs >= 2.3.2 flake8-builtins flake8-logging-format -numpy == 1.24.2 -scipy == 1.9.1 +numpy +scipy matplotlib == 3.7.1 astropy == 5.2.2 PyYAML @@ -16,7 +16,7 @@ h5py >= 3.7 scikit-image == 0.20.0 scikit-learn == 1.2.2 statsmodels == 0.13.5 -opencv-python-headless == 4.5.5.64 +opencv-python-headless == 4.7.0.72 psycopg requests >= 2.5 responses From 1008d543e8a38b7bdd966ec99f6f8a09e43d9441 Mon Sep 17 00:00:00 2001 From: Rasmus Handberg Date: Wed, 19 Apr 2023 17:26:29 +0200 Subject: [PATCH 6/7] Fixing numpy and scipy again --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7d733cf..cefd822 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,8 +5,8 @@ flake8 flake8-tabs >= 2.3.2 flake8-builtins flake8-logging-format -numpy -scipy +numpy == 1.24.2 +scipy == 1.10.1 matplotlib == 3.7.1 astropy == 5.2.2 PyYAML From d245ae71aa0fab5f78c31ffdac125196cf8fd655 Mon Sep 17 00:00:00 2001 From: Rasmus Handberg Date: Wed, 19 Apr 2023 17:29:32 +0200 Subject: [PATCH 7/7] More fiddeling with versions --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cefd822..2c3d87e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ flake8-tabs >= 2.3.2 flake8-builtins flake8-logging-format numpy == 1.24.2 -scipy == 1.10.1 +scipy == 1.9.1 matplotlib == 3.7.1 astropy == 5.2.2 PyYAML