From b972d883a8aa8d0018bd636114b707fd05d22804 Mon Sep 17 00:00:00 2001 From: Mahfouz Shehu Date: Thu, 1 Aug 2024 18:09:47 +0100 Subject: [PATCH 01/14] WIP, investigatin mismatch between local and prod, based on thesame database --- emgcli/settings.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/emgcli/settings.py b/emgcli/settings.py index c778d1f5a..d572265bc 100644 --- a/emgcli/settings.py +++ b/emgcli/settings.py @@ -324,7 +324,16 @@ def create_secret_key(var_dir): DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' try: - DATABASES = EMG_CONF['emg']['databases'] + # DATABASES = EMG_CONF['emg']['databases'] + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'emg', + 'USER': 'root', + 'HOST': 'mysql', + 'PORT': '3306', + } + } except KeyError: raise KeyError("Config must container default database.") From 2894ceb8a272133681e9d41a65a8f9ab15287665 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Thu, 8 Aug 2024 14:23:01 +0100 Subject: [PATCH 02/14] Added filter to prevent Analyses of Supressed studies from being returned via API --- emgapi/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emgapi/models.py b/emgapi/models.py index 31db68bb3..7490feb47 100644 --- a/emgapi/models.py +++ b/emgapi/models.py @@ -1698,10 +1698,11 @@ def available(self, request=None): - all | has access to public analyses - authenticated | has access to public and private analyses they own - Filtered out analyses for SUPPRESSED samples + Filtered out analyses for SUPPRESSED studies """ query_filters = { "all": [ + Q(study__is_suppressed=False), Q(study__is_private=False), Q(run__is_private=False) | Q(assembly__is_private=False), Q(is_suppressed=False), From b79c8cecdb2c58fbe4304864aa7137db8c1daa56 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Thu, 8 Aug 2024 15:11:35 +0100 Subject: [PATCH 03/14] Reverted settings.py to original format --- emgcli/settings.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/emgcli/settings.py b/emgcli/settings.py index d572265bc..7d936b765 100644 --- a/emgcli/settings.py +++ b/emgcli/settings.py @@ -128,12 +128,12 @@ }, }, 'loggers': { - 'emgena': { + 'emgena': { 'handlers': ['notify'], 'level': 'INFO', 'propagate': False }, - 'emgapianns.management.commands': { + 'emgapianns.management.commands': { 'handlers': ['default', 'console'], 'level': 'INFO', 'propagate': False @@ -324,16 +324,7 @@ def create_secret_key(var_dir): DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' try: - # DATABASES = EMG_CONF['emg']['databases'] - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'emg', - 'USER': 'root', - 'HOST': 'mysql', - 'PORT': '3306', - } - } + DATABASES = EMG_CONF['emg']['databases'] except KeyError: raise KeyError("Config must container default database.") @@ -348,8 +339,8 @@ def create_secret_key(var_dir): if 'ena' in DATABASES and 'ena_pro' not in DATABASES: DATABASES['ena_pro'] = DATABASES['ena'] -# this is required to use the djang-mysql QS Hints -# https://django-mysql.readthedocs.io/en/latest/queryset_extensions.html?highlight=DJANGO_MYSQL_REWRITE_QUERIES#query-hints +# this is required to use the djang-mysql QS Hints +# https://django-mysql.readthedocs.io/en/latest/queryset_extensions.html?highlight=DJANGO_MYSQL_REWRITE_QUERIES#query-hints DJANGO_MYSQL_REWRITE_QUERIES = True try: From e699e36f22b1c5e0b51964fc42a9b4c3e4c88cb0 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Thu, 8 Aug 2024 16:00:03 +0100 Subject: [PATCH 04/14] Removed duplicate install statement in tests file --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49e075edb..23e0af90a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: - name: 🔧 - Install Dependencies run: | - pip install install .[tests] + pip install .[tests] pip freeze - name: Check for unmigrated code changes From 2b3b4589338bebdcd1df1e834386d72f381c66df Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 10:40:49 +0100 Subject: [PATCH 05/14] Upgraded model_bakery version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cc8e6e465..107f93edc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ tests = [ "pytest==6.2.5", "pytest-django==4.4.0", "pytest-xdist==2.3.0", - "model_bakery==1.3.2", + "model_bakery==1.17.0", "mock_services==0.3.1", "mongomock==3.23.0", "jsonapi-client==0.9.9", From cfe55ad950e3994b01d43259e9932df12c7f3148 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 11:39:57 +0100 Subject: [PATCH 06/14] added numpy to webuploader dependencies --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 107f93edc..7a56cae19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,8 @@ admin = [ ] webuploader = [ - "pandas==1.3.2" + "pandas==1.3.2", + "numpy==1.21.2", ] [tool.pytest.ini_options] From b4dc20c37131c2ad04659661434b7bdf2d936bcf Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 11:59:45 +0100 Subject: [PATCH 07/14] upgraded pandas version for tests --- pyproject.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7a56cae19..3b24b7b78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ tests = [ "mongomock==3.23.0", "jsonapi-client==0.9.9", "pytest-cov==2.12.1", - "pandas==1.3.2", + "pandas==2.2.2", "responses==0.23.1", "Faker==19.6.2", ] @@ -93,8 +93,7 @@ admin = [ ] webuploader = [ - "pandas==1.3.2", - "numpy==1.21.2", + "pandas==1.3.2" ] [tool.pytest.ini_options] From 1a4fbe62da9ff89798741b4d37de31725abb6563 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 12:06:27 +0100 Subject: [PATCH 08/14] specified python 3.9 for testenv --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3b24b7b78..3d969a96a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,8 +114,12 @@ exclude = emgapi/migrations max-complexity = 10 max-line-length = 119 + +[testenv:py39] +basepython = python3.9 """ + [tool.bumpversion] current_version = "2.4.47" From 5a1c2eb602dfe957d8105bb7125a9736f57f7db7 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 12:13:49 +0100 Subject: [PATCH 09/14] lowered pandas version --- pyproject.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3d969a96a..6e0b7e08f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ tests = [ "mongomock==3.23.0", "jsonapi-client==0.9.9", "pytest-cov==2.12.1", - "pandas==2.2.2", + "pandas==2.2.1", "responses==0.23.1", "Faker==19.6.2", ] @@ -114,12 +114,8 @@ exclude = emgapi/migrations max-complexity = 10 max-line-length = 119 - -[testenv:py39] -basepython = python3.9 """ - [tool.bumpversion] current_version = "2.4.47" From 8f3022ec88888f1e27b079069c65854911efcf9a Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 12:19:57 +0100 Subject: [PATCH 10/14] attempting to resolve test dependendcies problems --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 6e0b7e08f..64bb8ca35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,6 +102,13 @@ python_files = "tests/*.py" [tool.tox] legacy_tox_ini = """ +[tox] +envlist = py39 + +[testenv] +deps = .[tests] +commands = pytest + [flake8] exclude = .git, From 7872366e672aac4e3c985a70c01a6d061e5c7d8a Mon Sep 17 00:00:00 2001 From: Sandy Rogers Date: Tue, 13 Aug 2024 14:25:01 +0100 Subject: [PATCH 11/14] drop python 3.8 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23e0af90a..7d842e098 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9] + python-version: [3.9] steps: - uses: actions/checkout@v3 From ad4da047a8813059cb30cecdcac861f5dab02fc5 Mon Sep 17 00:00:00 2001 From: Sandy Rogers Date: Tue, 13 Aug 2024 14:31:57 +0100 Subject: [PATCH 12/14] update tests for deprecated pandas util --- tests/webuploader/test_study_summary_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/webuploader/test_study_summary_generator.py b/tests/webuploader/test_study_summary_generator.py index 6fa6ecfe2..cd507ef36 100644 --- a/tests/webuploader/test_study_summary_generator.py +++ b/tests/webuploader/test_study_summary_generator.py @@ -19,7 +19,7 @@ import pandas as pd import pytest from model_bakery import baker -from pandas.util.testing import assert_frame_equal +from pandas.testing import assert_frame_equal from emgapianns.management.lib import study_summary_generator # noqa: E402 From 2f3f168a6f8c8dc57aaedebdf3ebf0b6f0c862b9 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 14:44:45 +0100 Subject: [PATCH 13/14] Removed unneccesary tool.tox config:c --- pyproject.toml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 64bb8ca35..6e0b7e08f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,13 +102,6 @@ python_files = "tests/*.py" [tool.tox] legacy_tox_ini = """ -[tox] -envlist = py39 - -[testenv] -deps = .[tests] -commands = pytest - [flake8] exclude = .git, From 1cca867b6142cdba4336e091d2ff1b9590eff4d5 Mon Sep 17 00:00:00 2001 From: mgs-sails Date: Tue, 13 Aug 2024 15:46:29 +0100 Subject: [PATCH 14/14] Bumped API version --- emgcli/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/emgcli/__init__.py b/emgcli/__init__.py index 6e315d022..afd05b54b 100644 --- a/emgcli/__init__.py +++ b/emgcli/__init__.py @@ -1 +1 @@ -__version__: str = "2.4.47" +__version__: str = "2.4.48" diff --git a/pyproject.toml b/pyproject.toml index 6e0b7e08f..f0c7ca7d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,7 +117,7 @@ max-line-length = 119 """ [tool.bumpversion] -current_version = "2.4.47" +current_version = "2.4.48" [[tool.bumpversion.files]] filename = "emgcli/__init__.py"