From ed804f2efd2bffecbfcd56f591b4c2f8082b1d3b Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 14:06:38 +0300 Subject: [PATCH 01/44] Fixing errors with python 3.12 on macos --- dev-dependencies.txt | 3 +-- spare_scores/mlp.py | 6 +++--- spare_scores/mlp_torch.py | 6 +++--- spare_scores/svm.py | 5 +++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dev-dependencies.txt b/dev-dependencies.txt index d12df9f..356c58a 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -3,7 +3,6 @@ attrs==23.1.0 certifi==2023.5.7 charset-normalizer==3.1.0 click==8.1.3 -# contourpy==1.2.1 cycler==0.11.0 exceptiongroup==1.1.1 filelock==3.12.2 @@ -33,7 +32,7 @@ pytz==2023.3 PyYAML==6.0.2 ray==2.34.0 requests==2.31.0 -scikit-learn==1.0.1 +scikit-learn==1.3.2 scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 diff --git a/spare_scores/mlp.py b/spare_scores/mlp.py index afb233a..27a6b0a 100644 --- a/spare_scores/mlp.py +++ b/spare_scores/mlp.py @@ -100,7 +100,7 @@ def __init__( "mlp__alpha": [0.001, 0.01, 0.05, 0.1], "mlp__learning_rate": ["constant", "adaptive"], "mlp__early_stopping": [True], - "mlp__max_iter": [500], + "mlp__max_iter": [1000], } def set_parameters(self, **parameters: Any) -> None: @@ -113,11 +113,11 @@ def _fit(self, df: pd.DataFrame) -> None: y = df[self.to_predict].astype("float64") if self.task == "Regression": - mlp = MLPRegressor(early_stopping=True, max_iter=500) + mlp = MLPRegressor(early_stopping=True, max_iter=1000) scoring = "neg_mean_absolute_error" metrics = ["MAE", "RMSE", "R2"] else: - mlp = MLPClassifier(early_stopping=True, max_iter=500) + mlp = MLPClassifier(early_stopping=True, max_iter=1000) scoring = "balanced_accuracy" metrics = [ "AUC", diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index b37a0ab..7d49afd 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -1,7 +1,7 @@ import logging import os import time -from typing import Any, Tuple +from typing import Any, Tuple, List import numpy as np import optuna @@ -220,7 +220,7 @@ def __init__( self.train_dl: Any self.val_dl: Any - def find_best_threshold(self, y_hat: list, y: list) -> Any: + def find_best_threshold(self, y_hat: list, y: list) -> List: """ Returns best threshold value using the roc_curve @@ -230,7 +230,7 @@ def find_best_threshold(self, y_hat: list, y: list) -> Any: :type y: list :return: the best threshold value - :rtype: Any + :rtype: List """ diff --git a/spare_scores/svm.py b/spare_scores/svm.py index a3a7b30..3cf1031 100644 --- a/spare_scores/svm.py +++ b/spare_scores/svm.py @@ -249,7 +249,7 @@ def train_initialize(self, df: pd.DataFrame, to_predict: str) -> None: ) self.to_predict, self.classify = to_predict, list(df[to_predict].unique()) self.mdl = ( - [LinearSVC(max_iter=100000, dual="auto")] + [LinearSVC(max_iter=100000, dual=False)] if self.kernel == "linear" else [SVC(max_iter=100000, kernel=self.kernel)] ) * len(self.folds) @@ -260,7 +260,7 @@ def train_initialize(self, df: pd.DataFrame, to_predict: str) -> None: ["MAE", "RMSE", "R2"], ) self.to_predict, self.classify = to_predict, None - self.mdl = [LinearSVR(max_iter=100000, dual="auto")] * len(self.folds) + self.mdl = [LinearSVR(max_iter=100000, loss='squared_epsilon_insensitive', dual=False)] * len(self.folds) self.bias_correct = { "slope": np.zeros((len(self.folds),)), "int": np.zeros((len(self.folds),)), @@ -320,6 +320,7 @@ def param_search( scoring=scoring, cv=self.k, return_train_score=True, + error_score=0.0, verbose=0, ) gs.fit(X_train, y_train) From 9fa0211860e07c6fd473014eb3723abcb8102e7f Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 14:37:53 +0300 Subject: [PATCH 02/44] Change variables to None from Any to stop the return error --- spare_scores/mlp_torch.py | 18 +++++++++--------- spare_scores/svm.py | 6 +++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index 7d49afd..eca9174 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -1,7 +1,7 @@ import logging import os import time -from typing import Any, Tuple, List +from typing import Any, Tuple import numpy as np import optuna @@ -213,14 +213,14 @@ def __init__( # Model settings self.classification = True if self.task == "Classification" else False - self.mdl: Any - self.scaler: Any - self.stats: Any - self.param: Any - self.train_dl: Any - self.val_dl: Any - - def find_best_threshold(self, y_hat: list, y: list) -> List: + self.mdl: None + self.scaler: None + self.stats: None + self.param: None + self.train_dl: None + self.val_dl: None + + def find_best_threshold(self, y_hat: list, y: list) -> Any: """ Returns best threshold value using the roc_curve diff --git a/spare_scores/svm.py b/spare_scores/svm.py index 3cf1031..2dd3dac 100644 --- a/spare_scores/svm.py +++ b/spare_scores/svm.py @@ -260,7 +260,11 @@ def train_initialize(self, df: pd.DataFrame, to_predict: str) -> None: ["MAE", "RMSE", "R2"], ) self.to_predict, self.classify = to_predict, None - self.mdl = [LinearSVR(max_iter=100000, loss='squared_epsilon_insensitive', dual=False)] * len(self.folds) + self.mdl = [ + LinearSVR( + max_iter=100000, loss="squared_epsilon_insensitive", dual=False + ) + ] * len(self.folds) self.bias_correct = { "slope": np.zeros((len(self.folds),)), "int": np.zeros((len(self.folds),)), From ea666fb14e1d4b03ff7197651c72645679ef8cb9 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 15:43:57 +0300 Subject: [PATCH 03/44] Change variable names with optional and Any | Fix test cases --- dev-dependencies.txt | 4 ++-- setup.cfg | 2 +- spare_scores/mlp_torch.py | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dev-dependencies.txt b/dev-dependencies.txt index 356c58a..baf6b4c 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -37,8 +37,8 @@ scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.2.0 -torchvision==0.17.1 +torch==2.3.1 +torchvision==0.18.1 typing_extensions==4.8.0 tzdata==2023.3 urllib3==2.0.3 diff --git a/setup.cfg b/setup.cfg index aae17b1..d7ecc64 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,7 @@ per-file-ignores = __init__.py: F401, F403 [mypy] -exclude= tests +exclude = tests # Import discovery namespace_packages = False ignore_missing_imports = True diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index eca9174..805caf8 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -1,7 +1,7 @@ import logging import os import time -from typing import Any, Tuple +from typing import Any, Optional, Tuple import numpy as np import optuna @@ -213,12 +213,12 @@ def __init__( # Model settings self.classification = True if self.task == "Classification" else False - self.mdl: None - self.scaler: None - self.stats: None - self.param: None - self.train_dl: None - self.val_dl: None + self.mdl: SimpleMLP + self.scaler: StandardScaler + self.stats: dict + self.param: Optional[Any] = None + self.train_dl: Optional[Any] = None + self.val_dl: Optional[Any] = None def find_best_threshold(self, y_hat: list, y: list) -> Any: """ From ab4c61b2beb686b67a00ac8450ece3b04c0fe439 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 16:17:20 +0300 Subject: [PATCH 04/44] Fixed issues with python 3.12 locally --- spare_scores/mlp_torch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index 805caf8..17e5a1f 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -1,7 +1,7 @@ import logging import os import time -from typing import Any, Optional, Tuple +from typing import Any, Tuple import numpy as np import optuna @@ -216,9 +216,9 @@ def __init__( self.mdl: SimpleMLP self.scaler: StandardScaler self.stats: dict - self.param: Optional[Any] = None - self.train_dl: Optional[Any] = None - self.val_dl: Optional[Any] = None + self.param: dict + self.train_dl: DataLoader + self.val_dl: DataLoader def find_best_threshold(self, y_hat: list, y: list) -> Any: """ From 5b0f67e4f007b3205cfe52701fa54824bc2ea0bc Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 16:40:05 +0300 Subject: [PATCH 05/44] Added badges for building --- .github/workflows/macos_test_cases_p3-12.yml | 4 ++-- README.md | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos_test_cases_p3-12.yml index b9c42d4..cb70cc5 100644 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -11,12 +11,12 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.12.4" - name: Set-up miniconda for macos and ubuntu uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true - python-version: 3.12 + python-version: 3.12.4 miniconda-version: "latest" - name: Create conda env run: conda create -n spare python=3.12 diff --git a/README.md b/README.md index 1f5dd37..2284e45 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ [![codecov](https://codecov.io/gh/CBICA/spare_score/graph/badge.svg?token=7yk7pkydHE)](https://codecov.io/gh/CBICA/spare_score) +![macos python=3.12 build](https://github.com/github/docs/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![macos python=3.8 build](https://github.com/github/docs/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.12 build](https://github.com/github/docs/actions/workflows/ubuntu_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.8 build](https://github.com/github/docs/actions/workflows/ubuntu_test_cases_p3-8.yml/badge.svg) # Compute SPARE Scores for Your Case @@ -38,7 +42,7 @@ Please open an issue if you find any bugs for the newer versions of spare_score # for python 3.12 git clone https://github.com/CBICA/spare_score.git cd spare_score - python -m pip install . + python -m pip install . # for python 3.8... python setup.py bdist_wheel From 23470d8b110c57c2b81d86e870631687f2d9ec0d Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 16:40:48 +0300 Subject: [PATCH 06/44] Remove conda env from workflow --- .github/workflows/macos_test_cases_p3-12.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos_test_cases_p3-12.yml index cb70cc5..2a0bec1 100644 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -5,23 +5,13 @@ on: [push, pull_request, workflow_dispatch] jobs: build: - runs-on: ["macos-13"] + runs-on: ["macos-latest"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12.4" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.12.4 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.12 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | pip install setuptools twine wheel From 0b5f677f0eb9e567d4a29af85da8be12dc25b214 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 16:48:33 +0300 Subject: [PATCH 07/44] Change macos version on workflow --- .github/workflows/macos_test_cases_p3-12.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos_test_cases_p3-12.yml index 2a0bec1..86e5e6a 100644 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -5,7 +5,7 @@ on: [push, pull_request, workflow_dispatch] jobs: build: - runs-on: ["macos-latest"] + runs-on: ["macos-13"] steps: - uses: actions/checkout@v4 From d2afb643d7137c57435d34c2b3325f33f7b8ff68 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 17:06:53 +0300 Subject: [PATCH 08/44] Try with pytest --- .github/workflows/macos_test_cases_p3-12.yml | 4 ++-- .github/workflows/macos_test_cases_p3-8.yml | 2 +- .github/workflows/ubuntu_test_cases_p3-12.yml | 2 +- .github/workflows/ubuntu_test_cases_p3-8.yml | 2 +- README.md | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos_test_cases_p3-12.yml index 86e5e6a..25c04e9 100644 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -1,4 +1,4 @@ -name: spare_scores test cases on macos for python 3.12 +name: MacOS python=3.12 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] @@ -18,4 +18,4 @@ jobs: python -m pip install . - name: Run unit tests run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" + cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/macos_test_cases_p3-8.yml b/.github/workflows/macos_test_cases_p3-8.yml index 7c91627..a82fb4d 100644 --- a/.github/workflows/macos_test_cases_p3-8.yml +++ b/.github/workflows/macos_test_cases_p3-8.yml @@ -1,4 +1,4 @@ -name: spare_scores test cases on macos for python 3.8 +name: MacOS python=3.8 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/ubuntu_test_cases_p3-12.yml b/.github/workflows/ubuntu_test_cases_p3-12.yml index 8d71e56..766b588 100644 --- a/.github/workflows/ubuntu_test_cases_p3-12.yml +++ b/.github/workflows/ubuntu_test_cases_p3-12.yml @@ -1,4 +1,4 @@ -name: spare_scores test cases on ubuntu for python 3.12 +name: Ubuntu python=3.12 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/ubuntu_test_cases_p3-8.yml b/.github/workflows/ubuntu_test_cases_p3-8.yml index 552323c..9a176d7 100644 --- a/.github/workflows/ubuntu_test_cases_p3-8.yml +++ b/.github/workflows/ubuntu_test_cases_p3-8.yml @@ -1,4 +1,4 @@ -name: spare_scores test cases on ubuntu for python 3.8 +name: Ubuntu python=3.8 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/README.md b/README.md index 2284e45..042ee73 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ [![codecov](https://codecov.io/gh/CBICA/spare_score/graph/badge.svg?token=7yk7pkydHE)](https://codecov.io/gh/CBICA/spare_score) -![macos python=3.12 build](https://github.com/github/docs/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) -![macos python=3.8 build](https://github.com/github/docs/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) -![ubuntu python=3.12 build](https://github.com/github/docs/actions/workflows/ubuntu_test_cases_p3-12.yml/badge.svg) -![ubuntu python=3.8 build](https://github.com/github/docs/actions/workflows/ubuntu_test_cases_p3-8.yml/badge.svg) +![macos python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![macos python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-8.yml/badge.svg) # Compute SPARE Scores for Your Case From 1a22bf8b7d2e89bd43f7e5796ce4ce5d1b00905f Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 17:10:13 +0300 Subject: [PATCH 09/44] Add pytest-cov to workflow --- .github/workflows/macos_test_cases_p3-12.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos_test_cases_p3-12.yml index 25c04e9..ce966bf 100644 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -14,7 +14,7 @@ jobs: python-version: "3.12.4" - name: Install spare scores run: | - pip install setuptools twine wheel + pip install setuptools twine wheel pytest pytest-cov python -m pip install . - name: Run unit tests run: | From 17032140f6d78ba38152b4ff9fe147a87e01b2f0 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 17:34:09 +0300 Subject: [PATCH 10/44] Change numpy version to 2.0.0 --- dev-dependencies.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-dependencies.txt b/dev-dependencies.txt index baf6b4c..0b61fa4 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -17,7 +17,7 @@ jsonschema==4.17.3 kiwisolver==1.4.4 matplotlib==3.9.0 msgpack==1.0.5 -numpy==1.22.0 +numpy==2.0.0 packaging==23.1 pandas==2.2.0 Pillow==9.5.0 From 57981e4dd45a13ea11e6069c868d4576d9375455 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 18:01:40 +0300 Subject: [PATCH 11/44] Changed numpy version again --- dev-dependencies.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dev-dependencies.txt b/dev-dependencies.txt index 0b61fa4..278ace4 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -15,15 +15,14 @@ iniconfig==2.0.0 joblib==1.3.1 jsonschema==4.17.3 kiwisolver==1.4.4 -matplotlib==3.9.0 +matplotlib==3.9.2 msgpack==1.0.5 -numpy==2.0.0 +numpy==1.26.4 packaging==23.1 -pandas==2.2.0 +pandas==2.2.2 Pillow==9.5.0 pkgutil_resolve_name==1.3.10 pluggy==1.5.0 -protobuf==4.23.3 pyparsing==3.1.0 pyrsistent==0.19.3 pytest==8.2.2 From aff177b66cabbbbeb7e36f1c4f6cd164ea7bac5c Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 18:38:02 +0300 Subject: [PATCH 12/44] Changed torch version --- dev-dependencies.txt | 4 ++-- test_data_prep.py | 0 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 test_data_prep.py diff --git a/dev-dependencies.txt b/dev-dependencies.txt index 278ace4..64baeb7 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -36,8 +36,8 @@ scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.3.1 -torchvision==0.18.1 +torch==2.2.2 +torchvision==0.17.2 typing_extensions==4.8.0 tzdata==2023.3 urllib3==2.0.3 diff --git a/test_data_prep.py b/test_data_prep.py deleted file mode 100644 index e69de29..0000000 From 9c102de4d5ecc6b75159d27891a07d22251eb996 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 19:00:09 +0300 Subject: [PATCH 13/44] Changed scikit learn and numpy versions --- dev-dependencies.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-dependencies.txt b/dev-dependencies.txt index 64baeb7..9354ed5 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -17,7 +17,7 @@ jsonschema==4.17.3 kiwisolver==1.4.4 matplotlib==3.9.2 msgpack==1.0.5 -numpy==1.26.4 +numpy==2.1.0 packaging==23.1 pandas==2.2.2 Pillow==9.5.0 @@ -31,7 +31,7 @@ pytz==2023.3 PyYAML==6.0.2 ray==2.34.0 requests==2.31.0 -scikit-learn==1.3.2 +scikit-learn==1.5.0 scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 From 05275b10effe12c2e31e8b3eb076b531adca5b99 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 19:03:36 +0300 Subject: [PATCH 14/44] Change MLPDataset to return torch.Tensor tuples instead of np.float32 --- spare_scores/mlp_torch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index 17e5a1f..9769050 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -59,13 +59,13 @@ def __len__(self) -> int: """ return len(self.y) - def __getitem__(self, idx: int) -> Tuple[np.float32, np.float32]: + def __getitem__(self, idx: int) -> Tuple[torch.Tensor, torch.Tensor]: """ (getter)returns the index of both X and y at index: idx(X[idx], y[idx]) :param idx: the index :type idx: int """ - return self.X[idx], self.y[idx] + return torch.tensor(self.X[idx]), torch.tensor(self.y[idx]) class SimpleMLP(nn.Module): From 8d51e794b6779663c4a990e44097197640e2f031 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 19:25:36 +0300 Subject: [PATCH 15/44] Changed all np.float32 to torch.Tensors --- spare_scores/mlp_torch.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index 9769050..5b8b596 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -50,8 +50,8 @@ class MLPDataset(Dataset): """ def __init__(self, X: list, y: list): - self.X = np.array(X, dtype=np.float32) - self.y = np.array(y, dtype=np.float32) + self.X = np.array(X, dtype=torch.Tensor) + self.y = np.array(y, dtype=torch.Tensor) def __len__(self) -> int: """ @@ -65,7 +65,7 @@ def __getitem__(self, idx: int) -> Tuple[torch.Tensor, torch.Tensor]: :param idx: the index :type idx: int """ - return torch.tensor(self.X[idx]), torch.tensor(self.y[idx]) + return self.X[idx], self.y[idx] class SimpleMLP(nn.Module): @@ -434,7 +434,7 @@ def fit(self, df: pd.DataFrame, verbose: int = 1, **kwargs: Any) -> dict: self.mdl.load_state_dict(best_model_state_dict) self.mdl.to(device) self.mdl.eval() - X_total = self.scaler.transform(np.array(X, dtype=np.float32)) + X_total = self.scaler.transform(np.array(X, dtype=torch.Tensor)) X_total = torch.tensor(X_total).to(device) self.y_pred = self.mdl(X_total).cpu().data.numpy() @@ -475,7 +475,7 @@ def fit(self, df: pd.DataFrame, verbose: int = 1, **kwargs: Any) -> dict: def predict(self, df: pd.DataFrame) -> np.ndarray: X = df[self.predictors] - X = self.scaler.transform(np.array(X, dtype=np.float32)) + X = self.scaler.transform(np.array(X, dtype=torch.Tensor)) X = torch.tensor(X).to(device) checkpoint_dict = self.param From 0962a6058d5cc8ac487d5d74a3f6c711e6fed53c Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 19:47:02 +0300 Subject: [PATCH 16/44] Changed part of the floats to tensors only --- spare_scores/mlp_torch.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index 5b8b596..afdd750 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -49,9 +49,9 @@ class MLPDataset(Dataset): """ - def __init__(self, X: list, y: list): - self.X = np.array(X, dtype=torch.Tensor) - self.y = np.array(y, dtype=torch.Tensor) + def __init__(self, X: list, y: list) -> None: + self.X = np.array(X, dtype=np.float32) + self.y = np.array(y, dtype=np.float32) def __len__(self) -> int: """ @@ -65,7 +65,7 @@ def __getitem__(self, idx: int) -> Tuple[torch.Tensor, torch.Tensor]: :param idx: the index :type idx: int """ - return self.X[idx], self.y[idx] + return torch.tensor(self.X[idx], dtype=torch.float32), torch.tensor(self.y[idx], dtype=torch.float32) class SimpleMLP(nn.Module): @@ -434,7 +434,7 @@ def fit(self, df: pd.DataFrame, verbose: int = 1, **kwargs: Any) -> dict: self.mdl.load_state_dict(best_model_state_dict) self.mdl.to(device) self.mdl.eval() - X_total = self.scaler.transform(np.array(X, dtype=torch.Tensor)) + X_total = self.scaler.transform(np.array(X, dtype=np.float32)) X_total = torch.tensor(X_total).to(device) self.y_pred = self.mdl(X_total).cpu().data.numpy() @@ -475,7 +475,7 @@ def fit(self, df: pd.DataFrame, verbose: int = 1, **kwargs: Any) -> dict: def predict(self, df: pd.DataFrame) -> np.ndarray: X = df[self.predictors] - X = self.scaler.transform(np.array(X, dtype=torch.Tensor)) + X = self.scaler.transform(np.array(X, dtype=np.float32)) X = torch.tensor(X).to(device) checkpoint_dict = self.param From 78dd2e53833285e3e3c5a28d772742b2b376e489 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 20:14:19 +0300 Subject: [PATCH 17/44] Changed numpy version to 1.26.4 again as it wasnt the problem --- .github/workflows/macos_test_cases_p3-12.yml | 1 + dev-dependencies.txt | 6 +++--- spare_scores/mlp_torch.py | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos_test_cases_p3-12.yml index ce966bf..07b06cd 100644 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -14,6 +14,7 @@ jobs: python-version: "3.12.4" - name: Install spare scores run: | + pip install -r dev-dependencies.txt pip install setuptools twine wheel pytest pytest-cov python -m pip install . - name: Run unit tests diff --git a/dev-dependencies.txt b/dev-dependencies.txt index 9354ed5..4b4bd6f 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -17,7 +17,7 @@ jsonschema==4.17.3 kiwisolver==1.4.4 matplotlib==3.9.2 msgpack==1.0.5 -numpy==2.1.0 +numpy==1.26.4 packaging==23.1 pandas==2.2.2 Pillow==9.5.0 @@ -36,8 +36,8 @@ scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.2.2 -torchvision==0.17.2 +torch==2.3.1 +torchvision==0.18.1 typing_extensions==4.8.0 tzdata==2023.3 urllib3==2.0.3 diff --git a/spare_scores/mlp_torch.py b/spare_scores/mlp_torch.py index afdd750..138ed33 100644 --- a/spare_scores/mlp_torch.py +++ b/spare_scores/mlp_torch.py @@ -65,7 +65,9 @@ def __getitem__(self, idx: int) -> Tuple[torch.Tensor, torch.Tensor]: :param idx: the index :type idx: int """ - return torch.tensor(self.X[idx], dtype=torch.float32), torch.tensor(self.y[idx], dtype=torch.float32) + return torch.tensor(self.X[idx], dtype=torch.float32), torch.tensor( + self.y[idx], dtype=torch.float32 + ) class SimpleMLP(nn.Module): From 349e5c6814aff7c017f3e9b44dc9b186e9f52b05 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 20:23:20 +0300 Subject: [PATCH 18/44] Required torch 2.2.2 version --- dev-dependencies.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-dependencies.txt b/dev-dependencies.txt index 4b4bd6f..abfb848 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -36,8 +36,8 @@ scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.3.1 -torchvision==0.18.1 +torch==2.2.2 +torchvision==0.17.1 typing_extensions==4.8.0 tzdata==2023.3 urllib3==2.0.3 From 33f86f4ed813958733d9717b1bec23fcd0728c8e Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 20:25:59 +0300 Subject: [PATCH 19/44] wrong torchvision version by mistake --- dev-dependencies.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-dependencies.txt b/dev-dependencies.txt index abfb848..e1752b5 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -36,7 +36,7 @@ scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.2.2 +torch==2.2.1 torchvision==0.17.1 typing_extensions==4.8.0 tzdata==2023.3 From 01bc4e25cf30b555e2cde9ce65089dd8e65b9f5a Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Sun, 1 Sep 2024 20:54:50 +0300 Subject: [PATCH 20/44] Fixed small typo on readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 042ee73..2cbd8fc 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Please open an issue if you find any bugs for the newer versions of spare_score cd spare_score python -m pip install . - # for python 3.8... + # for python 3.8 python setup.py bdist_wheel cd dist && pip install ... From 6460a124ae9aa7905930d32d4e652c682495f729 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 16:50:14 +0300 Subject: [PATCH 21/44] better workflows to run with all the python versions --- .github/workflows/codecov.yml | 46 +++++++++++++++---- ...s_test_cases_p3-12.yml => macos-tests.yml} | 9 ++-- .github/workflows/macos_test_cases_p3-8.yml | 42 ----------------- .github/workflows/ubuntu-tests.yml | 25 ++++++++++ .github/workflows/ubuntu_test_cases_p3-12.yml | 33 ------------- .github/workflows/ubuntu_test_cases_p3-8.yml | 36 --------------- README.md | 7 +-- 7 files changed, 70 insertions(+), 128 deletions(-) rename .github/workflows/{macos_test_cases_p3-12.yml => macos-tests.yml} (70%) delete mode 100644 .github/workflows/macos_test_cases_p3-8.yml create mode 100644 .github/workflows/ubuntu-tests.yml delete mode 100644 .github/workflows/ubuntu_test_cases_p3-12.yml delete mode 100644 .github/workflows/ubuntu_test_cases_p3-8.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 75aeba6..775bf83 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -1,14 +1,42 @@ -name: Test Coverage and Report to Codecov -on: - pull_request: - branches: ["main"] +name: codecov report + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] - jobs: - codecov: - runs-on: ubuntu-latest + build: + runs-on: ["macos-13"] + steps: - - name: Upload coverage reports - uses: codecov/codecov-action@v4.5.0 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.8 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Generate Coverage Report + run: | + pip install pytest-cov + cd tests/unit && pytest --cov=../../ --cov-report=xml + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} + slug: CBICA/spare_score diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos-tests.yml similarity index 70% rename from .github/workflows/macos_test_cases_p3-12.yml rename to .github/workflows/macos-tests.yml index 07b06cd..23c5303 100644 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ b/.github/workflows/macos-tests.yml @@ -1,4 +1,4 @@ -name: MacOS python=3.12 +name: macos tests # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] @@ -6,12 +6,15 @@ on: [push, pull_request, workflow_dispatch] jobs: build: runs-on: ["macos-13"] - + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + name: Python ${{ matrix.python-version }} sample steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.12.4" + python-version: ${{ matrix.python-version }} - name: Install spare scores run: | pip install -r dev-dependencies.txt diff --git a/.github/workflows/macos_test_cases_p3-8.yml b/.github/workflows/macos_test_cases_p3-8.yml deleted file mode 100644 index a82fb4d..0000000 --- a/.github/workflows/macos_test_cases_p3-8.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: MacOS python=3.8 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["macos-13"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.8 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.8 - - name: Install pip - run: conda run -n spare conda install pip - - name: Install spare scores - run: | - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Generate Coverage Report - run: | - pip install pytest-cov - cd tests/unit && pytest --cov=../../ --cov-report=xml - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: CBICA/spare_score diff --git a/.github/workflows/ubuntu-tests.yml b/.github/workflows/ubuntu-tests.yml new file mode 100644 index 0000000..bc8315b --- /dev/null +++ b/.github/workflows/ubuntu-tests.yml @@ -0,0 +1,25 @@ +name: ubuntu tests + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + name: Python ${{ matrix.python-version }} sample + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install spare scores + run: | + pip install setuptools twine wheel pytest pytest-cov + pip install -r dev-dependencies.txt + python -m pip install . + - name: Run unit tests + run: | + cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu_test_cases_p3-12.yml b/.github/workflows/ubuntu_test_cases_p3-12.yml deleted file mode 100644 index 766b588..0000000 --- a/.github/workflows/ubuntu_test_cases_p3-12.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Ubuntu python=3.12 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["ubuntu-latest"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.12 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.12 - - name: Install pip - run: conda run -n spare conda install pip - - name: Install spare scores - run: | - pip install setuptools twine wheel - python -m pip install . - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Run unit tests - run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu_test_cases_p3-8.yml b/.github/workflows/ubuntu_test_cases_p3-8.yml deleted file mode 100644 index 9a176d7..0000000 --- a/.github/workflows/ubuntu_test_cases_p3-8.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Ubuntu python=3.8 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["ubuntu-latest"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.8 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.8 - - name: Install pip - run: conda run -n spare conda install pip - - name: Install spare scores - run: | - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Run unit tests - run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/README.md b/README.md index 2cbd8fc..ee537d2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ [![codecov](https://codecov.io/gh/CBICA/spare_score/graph/badge.svg?token=7yk7pkydHE)](https://codecov.io/gh/CBICA/spare_score) -![macos python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) -![macos python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) -![ubuntu python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-12.yml/badge.svg) -![ubuntu python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-8.yml/badge.svg) - +![macos build](https://github.com/CBICA/spare_score/actions/workflows/macos-tests.yml/badge.svg) +![ubuntu build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests.yml/badge.svg) # Compute SPARE Scores for Your Case "SPARE" is short for "Spatial Pattern of Abnormalities for Recognition of ..." If you have brain images of a case population, such as the Alzheimer's disease (AD), the SPARE model will try to find characteristic brain patterns of AD with respect to a control population, such as cognitively normal. This would be an example of a classification-based SPARE model (currently powered by support vector machine or SVM). This model (that we named SPARE-AD) then computes SPARE-AD scores on an individual-basis that indicates how much the individual carries the learned brain patterns of AD. From 7867e7f2fe25d4f5158f868a86e5d596d6e1eb3f Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 16:58:14 +0300 Subject: [PATCH 22/44] add conda envoronment and manual pip installation --- .github/workflows/macos-tests.yml | 21 +++++++++++++++++---- .github/workflows/ubuntu-tests.yml | 21 +++++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/macos-tests.yml b/.github/workflows/macos-tests.yml index 23c5303..9f55a4c 100644 --- a/.github/workflows/macos-tests.yml +++ b/.github/workflows/macos-tests.yml @@ -9,17 +9,30 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} sample + name: Python ${{ matrix.python-version }} tests steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python= ${{ matrix.python-version }} + - name: Install pip + run: conda run -n spare conda install pip - name: Install spare scores run: | - pip install -r dev-dependencies.txt - pip install setuptools twine wheel pytest pytest-cov - python -m pip install . + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + pip install setuptools && pip install . - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests.yml b/.github/workflows/ubuntu-tests.yml index bc8315b..8d9a1d5 100644 --- a/.github/workflows/ubuntu-tests.yml +++ b/.github/workflows/ubuntu-tests.yml @@ -9,17 +9,30 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} sample + name: Python ${{ matrix.python-version }} tests steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python= ${{ matrix.python-version }} + - name: Install pip + run: conda run -n spare conda install pip - name: Install spare scores run: | - pip install setuptools twine wheel pytest pytest-cov - pip install -r dev-dependencies.txt - python -m pip install . + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + pip install setuptools && pip install . - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ From e0a26f65d3cf5e399c81e1c71a502d49212c2c83 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:16:13 +0300 Subject: [PATCH 23/44] Revert "add conda envoronment and manual pip installation" This reverts commit 7867e7f2fe25d4f5158f868a86e5d596d6e1eb3f. --- .github/workflows/macos-tests.yml | 21 ++++----------------- .github/workflows/ubuntu-tests.yml | 21 ++++----------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/.github/workflows/macos-tests.yml b/.github/workflows/macos-tests.yml index 9f55a4c..23c5303 100644 --- a/.github/workflows/macos-tests.yml +++ b/.github/workflows/macos-tests.yml @@ -9,30 +9,17 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} tests + name: Python ${{ matrix.python-version }} sample steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python= ${{ matrix.python-version }} - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - pip install setuptools && pip install . + pip install -r dev-dependencies.txt + pip install setuptools twine wheel pytest pytest-cov + python -m pip install . - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests.yml b/.github/workflows/ubuntu-tests.yml index 8d9a1d5..bc8315b 100644 --- a/.github/workflows/ubuntu-tests.yml +++ b/.github/workflows/ubuntu-tests.yml @@ -9,30 +9,17 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} tests + name: Python ${{ matrix.python-version }} sample steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python= ${{ matrix.python-version }} - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - pip install setuptools && pip install . + pip install setuptools twine wheel pytest pytest-cov + pip install -r dev-dependencies.txt + python -m pip install . - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ From 068fe9a4be1139b945789690bdd74d98d08f2f1a Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:18:44 +0300 Subject: [PATCH 24/44] Revert "better workflows to run with all the python versions" This reverts commit 6460a124ae9aa7905930d32d4e652c682495f729. --- .github/workflows/codecov.yml | 46 ++++--------------- ...s-tests.yml => macos_test_cases_p3-12.yml} | 9 ++-- .github/workflows/macos_test_cases_p3-8.yml | 42 +++++++++++++++++ .github/workflows/ubuntu-tests.yml | 25 ---------- .github/workflows/ubuntu_test_cases_p3-12.yml | 33 +++++++++++++ .github/workflows/ubuntu_test_cases_p3-8.yml | 36 +++++++++++++++ README.md | 7 ++- 7 files changed, 128 insertions(+), 70 deletions(-) rename .github/workflows/{macos-tests.yml => macos_test_cases_p3-12.yml} (70%) create mode 100644 .github/workflows/macos_test_cases_p3-8.yml delete mode 100644 .github/workflows/ubuntu-tests.yml create mode 100644 .github/workflows/ubuntu_test_cases_p3-12.yml create mode 100644 .github/workflows/ubuntu_test_cases_p3-8.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 775bf83..75aeba6 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -1,42 +1,14 @@ -name: codecov report - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] +name: Test Coverage and Report to Codecov +on: + pull_request: + branches: ["main"] + jobs: - build: - runs-on: ["macos-13"] - + codecov: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.8 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.8 - - name: Install pip - run: conda run -n spare conda install pip - - name: Install spare scores - run: | - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Generate Coverage Report - run: | - pip install pytest-cov - cd tests/unit && pytest --cov=../../ --cov-report=xml - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v4.0.1 + - name: Upload coverage reports + uses: codecov/codecov-action@v4.5.0 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: CBICA/spare_score diff --git a/.github/workflows/macos-tests.yml b/.github/workflows/macos_test_cases_p3-12.yml similarity index 70% rename from .github/workflows/macos-tests.yml rename to .github/workflows/macos_test_cases_p3-12.yml index 23c5303..07b06cd 100644 --- a/.github/workflows/macos-tests.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -1,4 +1,4 @@ -name: macos tests +name: MacOS python=3.12 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] @@ -6,15 +6,12 @@ on: [push, pull_request, workflow_dispatch] jobs: build: runs-on: ["macos-13"] - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} sample + steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.12.4" - name: Install spare scores run: | pip install -r dev-dependencies.txt diff --git a/.github/workflows/macos_test_cases_p3-8.yml b/.github/workflows/macos_test_cases_p3-8.yml new file mode 100644 index 0000000..a82fb4d --- /dev/null +++ b/.github/workflows/macos_test_cases_p3-8.yml @@ -0,0 +1,42 @@ +name: MacOS python=3.8 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["macos-13"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.8 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Generate Coverage Report + run: | + pip install pytest-cov + cd tests/unit && pytest --cov=../../ --cov-report=xml + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: CBICA/spare_score diff --git a/.github/workflows/ubuntu-tests.yml b/.github/workflows/ubuntu-tests.yml deleted file mode 100644 index bc8315b..0000000 --- a/.github/workflows/ubuntu-tests.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: ubuntu tests - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["ubuntu-latest"] - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} sample - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install spare scores - run: | - pip install setuptools twine wheel pytest pytest-cov - pip install -r dev-dependencies.txt - python -m pip install . - - name: Run unit tests - run: | - cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu_test_cases_p3-12.yml b/.github/workflows/ubuntu_test_cases_p3-12.yml new file mode 100644 index 0000000..766b588 --- /dev/null +++ b/.github/workflows/ubuntu_test_cases_p3-12.yml @@ -0,0 +1,33 @@ +name: Ubuntu python=3.12 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.12 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.12 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python -m pip install . + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu_test_cases_p3-8.yml b/.github/workflows/ubuntu_test_cases_p3-8.yml new file mode 100644 index 0000000..9a176d7 --- /dev/null +++ b/.github/workflows/ubuntu_test_cases_p3-8.yml @@ -0,0 +1,36 @@ +name: Ubuntu python=3.8 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.8 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/README.md b/README.md index ee537d2..2cbd8fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ [![codecov](https://codecov.io/gh/CBICA/spare_score/graph/badge.svg?token=7yk7pkydHE)](https://codecov.io/gh/CBICA/spare_score) -![macos build](https://github.com/CBICA/spare_score/actions/workflows/macos-tests.yml/badge.svg) -![ubuntu build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests.yml/badge.svg) +![macos python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![macos python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-8.yml/badge.svg) + # Compute SPARE Scores for Your Case "SPARE" is short for "Spatial Pattern of Abnormalities for Recognition of ..." If you have brain images of a case population, such as the Alzheimer's disease (AD), the SPARE model will try to find characteristic brain patterns of AD with respect to a control population, such as cognitively normal. This would be an example of a classification-based SPARE model (currently powered by support vector machine or SVM). This model (that we named SPARE-AD) then computes SPARE-AD scores on an individual-basis that indicates how much the individual carries the learned brain patterns of AD. From bf6c14293f7223a707eaf2ae9c7493a53532b719 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:19:07 +0300 Subject: [PATCH 25/44] revert the workflow changes --- .github/workflows/macos-tests-3.12.yml | 33 +++++++++++++++++++ ...est_cases_p3-8.yml => macos-tests-3.8.yml} | 0 .github/workflows/macos_test_cases_p3-12.yml | 22 ------------- ...t_cases_p3-8.yml => ubuntu-tersts-3.8.yml} | 0 ..._cases_p3-12.yml => ubuntu-tests-3.12.yml} | 0 5 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/macos-tests-3.12.yml rename .github/workflows/{macos_test_cases_p3-8.yml => macos-tests-3.8.yml} (100%) delete mode 100644 .github/workflows/macos_test_cases_p3-12.yml rename .github/workflows/{ubuntu_test_cases_p3-8.yml => ubuntu-tersts-3.8.yml} (100%) rename .github/workflows/{ubuntu_test_cases_p3-12.yml => ubuntu-tests-3.12.yml} (100%) diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml new file mode 100644 index 0000000..9717236 --- /dev/null +++ b/.github/workflows/macos-tests-3.12.yml @@ -0,0 +1,33 @@ +name: macos python=3.12 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["macos-13"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.12 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.12 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python -m pip install . + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/macos_test_cases_p3-8.yml b/.github/workflows/macos-tests-3.8.yml similarity index 100% rename from .github/workflows/macos_test_cases_p3-8.yml rename to .github/workflows/macos-tests-3.8.yml diff --git a/.github/workflows/macos_test_cases_p3-12.yml b/.github/workflows/macos_test_cases_p3-12.yml deleted file mode 100644 index 07b06cd..0000000 --- a/.github/workflows/macos_test_cases_p3-12.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: MacOS python=3.12 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["macos-13"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.12.4" - - name: Install spare scores - run: | - pip install -r dev-dependencies.txt - pip install setuptools twine wheel pytest pytest-cov - python -m pip install . - - name: Run unit tests - run: | - cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu_test_cases_p3-8.yml b/.github/workflows/ubuntu-tersts-3.8.yml similarity index 100% rename from .github/workflows/ubuntu_test_cases_p3-8.yml rename to .github/workflows/ubuntu-tersts-3.8.yml diff --git a/.github/workflows/ubuntu_test_cases_p3-12.yml b/.github/workflows/ubuntu-tests-3.12.yml similarity index 100% rename from .github/workflows/ubuntu_test_cases_p3-12.yml rename to .github/workflows/ubuntu-tests-3.12.yml From 644ad23f29b975210090c2e782eb58c6d77946a8 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:27:49 +0300 Subject: [PATCH 26/44] Manually added more workflows for the other versions --- .github/workflows/macos-tests-3.10.yml | 42 +++++++++++++++++++ .github/workflows/macos-tests-3.11.yml | 42 +++++++++++++++++++ .github/workflows/macos-tests-3.8.yml | 2 +- .github/workflows/macos-tests-3.9.yml | 42 +++++++++++++++++++ .github/workflows/ubuntu-tests-3.10.yml | 36 ++++++++++++++++ .github/workflows/ubuntu-tests-3.11.yml | 36 ++++++++++++++++ .github/workflows/ubuntu-tests-3.12.yml | 2 +- ...tu-tersts-3.8.yml => ubuntu-tests-3.8.yml} | 2 +- .github/workflows/ubuntu-tests-3.9.yml | 36 ++++++++++++++++ README.md | 14 +++++-- dev-dependencies.txt | 1 + 11 files changed, 248 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/macos-tests-3.10.yml create mode 100644 .github/workflows/macos-tests-3.11.yml create mode 100644 .github/workflows/macos-tests-3.9.yml create mode 100644 .github/workflows/ubuntu-tests-3.10.yml create mode 100644 .github/workflows/ubuntu-tests-3.11.yml rename .github/workflows/{ubuntu-tersts-3.8.yml => ubuntu-tests-3.8.yml} (97%) create mode 100644 .github/workflows/ubuntu-tests-3.9.yml diff --git a/.github/workflows/macos-tests-3.10.yml b/.github/workflows/macos-tests-3.10.yml new file mode 100644 index 0000000..490f8fd --- /dev/null +++ b/.github/workflows/macos-tests-3.10.yml @@ -0,0 +1,42 @@ +name: macos python=3.10 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["macos-13"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.10 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.10 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Generate Coverage Report + run: | + pip install pytest-cov + cd tests/unit && pytest --cov=../../ --cov-report=xml + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: CBICA/spare_score diff --git a/.github/workflows/macos-tests-3.11.yml b/.github/workflows/macos-tests-3.11.yml new file mode 100644 index 0000000..36f3619 --- /dev/null +++ b/.github/workflows/macos-tests-3.11.yml @@ -0,0 +1,42 @@ +name: macos python=3.11 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["macos-13"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.11 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.11 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Generate Coverage Report + run: | + pip install pytest-cov + cd tests/unit && pytest --cov=../../ --cov-report=xml + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: CBICA/spare_score diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index a82fb4d..df3f903 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -1,4 +1,4 @@ -name: MacOS python=3.8 +name: macos python=3.8 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/macos-tests-3.9.yml b/.github/workflows/macos-tests-3.9.yml new file mode 100644 index 0000000..9022725 --- /dev/null +++ b/.github/workflows/macos-tests-3.9.yml @@ -0,0 +1,42 @@ +name: macos python=3.9 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["macos-13"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.9" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.9 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.9 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Generate Coverage Report + run: | + pip install pytest-cov + cd tests/unit && pytest --cov=../../ --cov-report=xml + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: CBICA/spare_score diff --git a/.github/workflows/ubuntu-tests-3.10.yml b/.github/workflows/ubuntu-tests-3.10.yml new file mode 100644 index 0000000..46dcbeb --- /dev/null +++ b/.github/workflows/ubuntu-tests-3.10.yml @@ -0,0 +1,36 @@ +name: ubuntu python=3.10 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.10 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.10 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.11.yml b/.github/workflows/ubuntu-tests-3.11.yml new file mode 100644 index 0000000..f36b53b --- /dev/null +++ b/.github/workflows/ubuntu-tests-3.11.yml @@ -0,0 +1,36 @@ +name: ubuntu python=3.11 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.11 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.11 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index 766b588..c6d2cb4 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -1,4 +1,4 @@ -name: Ubuntu python=3.12 +name: ubuntu python=3.12 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/ubuntu-tersts-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml similarity index 97% rename from .github/workflows/ubuntu-tersts-3.8.yml rename to .github/workflows/ubuntu-tests-3.8.yml index 9a176d7..f4e30cd 100644 --- a/.github/workflows/ubuntu-tersts-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -1,4 +1,4 @@ -name: Ubuntu python=3.8 +name: ubuntu python=3.8 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/ubuntu-tests-3.9.yml b/.github/workflows/ubuntu-tests-3.9.yml new file mode 100644 index 0000000..d7fabfc --- /dev/null +++ b/.github/workflows/ubuntu-tests-3.9.yml @@ -0,0 +1,36 @@ +name: ubuntu python=3.9 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.9" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.9 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.9 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/README.md b/README.md index 2cbd8fc..b1ff1e9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@ [![codecov](https://codecov.io/gh/CBICA/spare_score/graph/badge.svg?token=7yk7pkydHE)](https://codecov.io/gh/CBICA/spare_score) -![macos python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) -![macos python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) -![ubuntu python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-12.yml/badge.svg) -![ubuntu python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-8.yml/badge.svg) +![macos python=3.12](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.12.yml/badge.svg) +![macos python=3.11](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.11.yml/badge.svg) +![macos python=3.10](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.10.yml/badge.svg) +![macos python=3.9](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.9.yml/badge.svg) +![macos python=3.8](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.8.yml/badge.svg) +![ubuntu python=3.12](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.12.yml/badge.svg) +![ubuntu python=3.11](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.11.yml/badge.svg) +![ubuntu python=3.10](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.10.yml/badge.svg) +![ubuntu python=3.9](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.9.yml/badge.svg) +![ubuntu python=3.8](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.8.yml/badge.svg) # Compute SPARE Scores for Your Case diff --git a/dev-dependencies.txt b/dev-dependencies.txt index e1752b5..33a3c16 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -26,6 +26,7 @@ pluggy==1.5.0 pyparsing==3.1.0 pyrsistent==0.19.3 pytest==8.2.2 +pytest-cov==5.0.0 python-dateutil==2.8.2 pytz==2023.3 PyYAML==6.0.2 From fc446d151128d279ec2c533716e1ea2f1c0159ef Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:31:36 +0300 Subject: [PATCH 27/44] Added cache purge for pip install --- .github/workflows/macos-tests-3.10.yml | 1 + .github/workflows/macos-tests-3.11.yml | 1 + .github/workflows/macos-tests-3.12.yml | 1 + .github/workflows/macos-tests-3.8.yml | 1 + .github/workflows/macos-tests-3.9.yml | 1 + .github/workflows/ubuntu-tests-3.10.yml | 1 + .github/workflows/ubuntu-tests-3.11.yml | 1 + .github/workflows/ubuntu-tests-3.12.yml | 1 + .github/workflows/ubuntu-tests-3.8.yml | 1 + .github/workflows/ubuntu-tests-3.9.yml | 1 + 10 files changed, 10 insertions(+) diff --git a/.github/workflows/macos-tests-3.10.yml b/.github/workflows/macos-tests-3.10.yml index 490f8fd..70d2557 100644 --- a/.github/workflows/macos-tests-3.10.yml +++ b/.github/workflows/macos-tests-3.10.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/macos-tests-3.11.yml b/.github/workflows/macos-tests-3.11.yml index 36f3619..e897239 100644 --- a/.github/workflows/macos-tests-3.11.yml +++ b/.github/workflows/macos-tests-3.11.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml index 9717236..5fa18b8 100644 --- a/.github/workflows/macos-tests-3.12.yml +++ b/.github/workflows/macos-tests-3.12.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python -m pip install . - name: Download dependencies diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index df3f903..6c2eb7c 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/macos-tests-3.9.yml b/.github/workflows/macos-tests-3.9.yml index 9022725..efa5a65 100644 --- a/.github/workflows/macos-tests-3.9.yml +++ b/.github/workflows/macos-tests-3.9.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/ubuntu-tests-3.10.yml b/.github/workflows/ubuntu-tests-3.10.yml index 46dcbeb..9e313a3 100644 --- a/.github/workflows/ubuntu-tests-3.10.yml +++ b/.github/workflows/ubuntu-tests-3.10.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/ubuntu-tests-3.11.yml b/.github/workflows/ubuntu-tests-3.11.yml index f36b53b..2daf4f2 100644 --- a/.github/workflows/ubuntu-tests-3.11.yml +++ b/.github/workflows/ubuntu-tests-3.11.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index c6d2cb4..9c90ced 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python -m pip install . - name: Download dependencies diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index f4e30cd..58fa623 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/ubuntu-tests-3.9.yml b/.github/workflows/ubuntu-tests-3.9.yml index d7fabfc..f774981 100644 --- a/.github/workflows/ubuntu-tests-3.9.yml +++ b/.github/workflows/ubuntu-tests-3.9.yml @@ -24,6 +24,7 @@ jobs: run: conda run -n spare conda install pip - name: Install spare scores run: | + python -m pip cache purge pip install setuptools twine wheel python setup.py bdist_wheel cd dist From 6ca8db1391ae9190a3f572f9ae4e71d32485ec2b Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:36:07 +0300 Subject: [PATCH 28/44] Remove conda environments and add only pytest --- .github/workflows/macos-tests-3.10.yml | 10 ---------- .github/workflows/macos-tests-3.11.yml | 10 ---------- .github/workflows/macos-tests-3.12.yml | 10 ---------- .github/workflows/macos-tests-3.8.yml | 10 ---------- .github/workflows/macos-tests-3.9.yml | 10 ---------- .github/workflows/ubuntu-tests-3.10.yml | 12 +----------- .github/workflows/ubuntu-tests-3.11.yml | 12 +----------- .github/workflows/ubuntu-tests-3.12.yml | 12 +----------- .github/workflows/ubuntu-tests-3.8.yml | 12 +----------- .github/workflows/ubuntu-tests-3.9.yml | 12 +----------- 10 files changed, 5 insertions(+), 105 deletions(-) diff --git a/.github/workflows/macos-tests-3.10.yml b/.github/workflows/macos-tests-3.10.yml index 70d2557..f2b362b 100644 --- a/.github/workflows/macos-tests-3.10.yml +++ b/.github/workflows/macos-tests-3.10.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.10 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.10 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge diff --git a/.github/workflows/macos-tests-3.11.yml b/.github/workflows/macos-tests-3.11.yml index e897239..6e263f6 100644 --- a/.github/workflows/macos-tests-3.11.yml +++ b/.github/workflows/macos-tests-3.11.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.11" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.11 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.11 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml index 5fa18b8..5c5db75 100644 --- a/.github/workflows/macos-tests-3.12.yml +++ b/.github/workflows/macos-tests-3.12.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.12" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.12 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.12 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index 6c2eb7c..b90ad11 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.8" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.8 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.8 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge diff --git a/.github/workflows/macos-tests-3.9.yml b/.github/workflows/macos-tests-3.9.yml index efa5a65..9e392d8 100644 --- a/.github/workflows/macos-tests-3.9.yml +++ b/.github/workflows/macos-tests-3.9.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.9" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.9 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.9 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge diff --git a/.github/workflows/ubuntu-tests-3.10.yml b/.github/workflows/ubuntu-tests-3.10.yml index 9e313a3..e633a42 100644 --- a/.github/workflows/ubuntu-tests-3.10.yml +++ b/.github/workflows/ubuntu-tests-3.10.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.10 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.10 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge @@ -34,4 +24,4 @@ jobs: run: pip install setuptools && pip install . - name: Run unit tests run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" + cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.11.yml b/.github/workflows/ubuntu-tests-3.11.yml index 2daf4f2..8156691 100644 --- a/.github/workflows/ubuntu-tests-3.11.yml +++ b/.github/workflows/ubuntu-tests-3.11.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.11" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.11 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.11 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge @@ -34,4 +24,4 @@ jobs: run: pip install setuptools && pip install . - name: Run unit tests run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" + cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index 9c90ced..038f30d 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.12" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.12 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.12 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge @@ -31,4 +21,4 @@ jobs: run: pip install setuptools && pip install . - name: Run unit tests run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" + cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index 58fa623..94d8070 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.8" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.8 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.8 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge @@ -34,4 +24,4 @@ jobs: run: pip install setuptools && pip install . - name: Run unit tests run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" + cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.9.yml b/.github/workflows/ubuntu-tests-3.9.yml index f774981..72f475e 100644 --- a/.github/workflows/ubuntu-tests-3.9.yml +++ b/.github/workflows/ubuntu-tests-3.9.yml @@ -12,16 +12,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.9" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.9 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.9 - - name: Install pip - run: conda run -n spare conda install pip - name: Install spare scores run: | python -m pip cache purge @@ -34,4 +24,4 @@ jobs: run: pip install setuptools && pip install . - name: Run unit tests run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" + cd tests/unit && pytest --cov=../../ From 0cf864ea43fc062a1af8948a5ad080d85ded3656 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:42:06 +0300 Subject: [PATCH 29/44] Add pytest installation to ubuntu workflows --- .github/workflows/ubuntu-tests-3.10.yml | 2 +- .github/workflows/ubuntu-tests-3.11.yml | 2 +- .github/workflows/ubuntu-tests-3.12.yml | 2 +- .github/workflows/ubuntu-tests-3.8.yml | 2 +- .github/workflows/ubuntu-tests-3.9.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ubuntu-tests-3.10.yml b/.github/workflows/ubuntu-tests-3.10.yml index e633a42..a021079 100644 --- a/.github/workflows/ubuntu-tests-3.10.yml +++ b/.github/workflows/ubuntu-tests-3.10.yml @@ -21,7 +21,7 @@ jobs: WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.11.yml b/.github/workflows/ubuntu-tests-3.11.yml index 8156691..529ece0 100644 --- a/.github/workflows/ubuntu-tests-3.11.yml +++ b/.github/workflows/ubuntu-tests-3.11.yml @@ -21,7 +21,7 @@ jobs: WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index 038f30d..da790fb 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -18,7 +18,7 @@ jobs: pip install setuptools twine wheel python -m pip install . - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index 94d8070..1b6ad6a 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -21,7 +21,7 @@ jobs: WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu-tests-3.9.yml b/.github/workflows/ubuntu-tests-3.9.yml index 72f475e..f7b3d98 100644 --- a/.github/workflows/ubuntu-tests-3.9.yml +++ b/.github/workflows/ubuntu-tests-3.9.yml @@ -21,7 +21,7 @@ jobs: WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ From d53ff0225239f3cdd81a7e713895fdeb13fd718a Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:48:17 +0300 Subject: [PATCH 30/44] Change matplotlib version --- .github/workflows/ubuntu-tests-3.8.yml | 2 +- dev-dependencies.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index 1b6ad6a..94d8070 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -21,7 +21,7 @@ jobs: WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt + run: pip install setuptools && pip install . - name: Run unit tests run: | cd tests/unit && pytest --cov=../../ diff --git a/dev-dependencies.txt b/dev-dependencies.txt index 33a3c16..2a90574 100644 --- a/dev-dependencies.txt +++ b/dev-dependencies.txt @@ -15,7 +15,7 @@ iniconfig==2.0.0 joblib==1.3.1 jsonschema==4.17.3 kiwisolver==1.4.4 -matplotlib==3.9.2 +matplotlib==3.8.0 msgpack==1.0.5 numpy==1.26.4 packaging==23.1 From 70eb8d8f03a3322bc79f57d8e0397d05afed16fa Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:51:03 +0300 Subject: [PATCH 31/44] Change pytest for ubuntu --- .github/workflows/ubuntu-tests-3.10.yml | 2 +- .github/workflows/ubuntu-tests-3.11.yml | 2 +- .github/workflows/ubuntu-tests-3.12.yml | 2 +- .github/workflows/ubuntu-tests-3.8.yml | 2 +- .github/workflows/ubuntu-tests-3.9.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ubuntu-tests-3.10.yml b/.github/workflows/ubuntu-tests-3.10.yml index a021079..5b63c9e 100644 --- a/.github/workflows/ubuntu-tests-3.10.yml +++ b/.github/workflows/ubuntu-tests-3.10.yml @@ -24,4 +24,4 @@ jobs: run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | - cd tests/unit && pytest --cov=../../ + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.11.yml b/.github/workflows/ubuntu-tests-3.11.yml index 529ece0..3b00512 100644 --- a/.github/workflows/ubuntu-tests-3.11.yml +++ b/.github/workflows/ubuntu-tests-3.11.yml @@ -24,4 +24,4 @@ jobs: run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | - cd tests/unit && pytest --cov=../../ + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index da790fb..64d7712 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -21,4 +21,4 @@ jobs: run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | - cd tests/unit && pytest --cov=../../ + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index 94d8070..e6b6959 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -24,4 +24,4 @@ jobs: run: pip install setuptools && pip install . - name: Run unit tests run: | - cd tests/unit && pytest --cov=../../ + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.9.yml b/.github/workflows/ubuntu-tests-3.9.yml index f7b3d98..d9d6089 100644 --- a/.github/workflows/ubuntu-tests-3.9.yml +++ b/.github/workflows/ubuntu-tests-3.9.yml @@ -24,4 +24,4 @@ jobs: run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | - cd tests/unit && pytest --cov=../../ + cd tests/unit && python -m unittest discover -s . -p "*.py" From 2a6c853b8532eaf7ede8a3862dca1848268fda0f Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:56:25 +0300 Subject: [PATCH 32/44] Fix readme builds and remove some workflows --- .github/workflows/macos-tests-3.10.yml | 33 ------------------------- .github/workflows/macos-tests-3.11.yml | 33 ------------------------- .github/workflows/macos-tests-3.9.yml | 33 ------------------------- .github/workflows/ubuntu-tests-3.10.yml | 27 -------------------- .github/workflows/ubuntu-tests-3.11.yml | 27 -------------------- .github/workflows/ubuntu-tests-3.9.yml | 27 -------------------- README.md | 12 ++------- 7 files changed, 2 insertions(+), 190 deletions(-) delete mode 100644 .github/workflows/macos-tests-3.10.yml delete mode 100644 .github/workflows/macos-tests-3.11.yml delete mode 100644 .github/workflows/macos-tests-3.9.yml delete mode 100644 .github/workflows/ubuntu-tests-3.10.yml delete mode 100644 .github/workflows/ubuntu-tests-3.11.yml delete mode 100644 .github/workflows/ubuntu-tests-3.9.yml diff --git a/.github/workflows/macos-tests-3.10.yml b/.github/workflows/macos-tests-3.10.yml deleted file mode 100644 index f2b362b..0000000 --- a/.github/workflows/macos-tests-3.10.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: macos python=3.10 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["macos-13"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Install spare scores - run: | - python -m pip cache purge - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Generate Coverage Report - run: | - pip install pytest-cov - cd tests/unit && pytest --cov=../../ --cov-report=xml - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: CBICA/spare_score diff --git a/.github/workflows/macos-tests-3.11.yml b/.github/workflows/macos-tests-3.11.yml deleted file mode 100644 index 6e263f6..0000000 --- a/.github/workflows/macos-tests-3.11.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: macos python=3.11 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["macos-13"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install spare scores - run: | - python -m pip cache purge - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Generate Coverage Report - run: | - pip install pytest-cov - cd tests/unit && pytest --cov=../../ --cov-report=xml - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: CBICA/spare_score diff --git a/.github/workflows/macos-tests-3.9.yml b/.github/workflows/macos-tests-3.9.yml deleted file mode 100644 index 9e392d8..0000000 --- a/.github/workflows/macos-tests-3.9.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: macos python=3.9 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["macos-13"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - name: Install spare scores - run: | - python -m pip cache purge - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Generate Coverage Report - run: | - pip install pytest-cov - cd tests/unit && pytest --cov=../../ --cov-report=xml - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: CBICA/spare_score diff --git a/.github/workflows/ubuntu-tests-3.10.yml b/.github/workflows/ubuntu-tests-3.10.yml deleted file mode 100644 index 5b63c9e..0000000 --- a/.github/workflows/ubuntu-tests-3.10.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: ubuntu python=3.10 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["ubuntu-latest"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Install spare scores - run: | - python -m pip cache purge - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt - - name: Run unit tests - run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.11.yml b/.github/workflows/ubuntu-tests-3.11.yml deleted file mode 100644 index 3b00512..0000000 --- a/.github/workflows/ubuntu-tests-3.11.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: ubuntu python=3.11 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["ubuntu-latest"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install spare scores - run: | - python -m pip cache purge - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt - - name: Run unit tests - run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.9.yml b/.github/workflows/ubuntu-tests-3.9.yml deleted file mode 100644 index d9d6089..0000000 --- a/.github/workflows/ubuntu-tests-3.9.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: ubuntu python=3.9 - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["ubuntu-latest"] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - name: Install spare scores - run: | - python -m pip cache purge - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt - - name: Run unit tests - run: | - cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/README.md b/README.md index b1ff1e9..1111a3a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,6 @@ [![codecov](https://codecov.io/gh/CBICA/spare_score/graph/badge.svg?token=7yk7pkydHE)](https://codecov.io/gh/CBICA/spare_score) -![macos python=3.12](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.12.yml/badge.svg) -![macos python=3.11](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.11.yml/badge.svg) -![macos python=3.10](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.10.yml/badge.svg) -![macos python=3.9](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.9.yml/badge.svg) -![macos python=3.8](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.8.yml/badge.svg) -![ubuntu python=3.12](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.12.yml/badge.svg) -![ubuntu python=3.11](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.11.yml/badge.svg) -![ubuntu python=3.10](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.10.yml/badge.svg) -![ubuntu python=3.9](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.9.yml/badge.svg) -![ubuntu python=3.8](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.8.yml/badge.svg) +![macos tests](https://github.com/CBICA/spare_score/actions/workflows/macos-tests-3.12.yml/badge.svg) +![ubuntu tests](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests-3.12.yml/badge.svg) # Compute SPARE Scores for Your Case From ea16411f5767f2b068e8b5ebdb3878ecd446ccf4 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 17:57:28 +0300 Subject: [PATCH 33/44] Fix actions titles --- .github/workflows/macos-tests-3.12.yml | 2 +- .github/workflows/macos-tests-3.8.yml | 2 +- .github/workflows/ubuntu-tests-3.12.yml | 2 +- .github/workflows/ubuntu-tests-3.8.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml index 5c5db75..aeaf295 100644 --- a/.github/workflows/macos-tests-3.12.yml +++ b/.github/workflows/macos-tests-3.12.yml @@ -1,4 +1,4 @@ -name: macos python=3.12 +name: macos build # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index b90ad11..793f4cd 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -1,4 +1,4 @@ -name: macos python=3.8 +name: macos build python=3.12 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index 64d7712..b0f51cb 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -1,4 +1,4 @@ -name: ubuntu python=3.12 +name: ubuntu build # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index e6b6959..0978109 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -1,4 +1,4 @@ -name: ubuntu python=3.8 +name: ubuntu build python=3.8 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] From 6f198e5c1eb9b2812ea4d10730fb0bf5ce309066 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:11:05 +0300 Subject: [PATCH 34/44] Fix pytest not exist --- .github/workflows/macos-tests-3.8.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index 793f4cd..da2f1de 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -1,4 +1,4 @@ -name: macos build python=3.12 +name: macos build python=3.8 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] @@ -24,7 +24,7 @@ jobs: run: pip install setuptools && pip install . - name: Generate Coverage Report run: | - pip install pytest-cov + pip install pytest pytest-cov cd tests/unit && pytest --cov=../../ --cov-report=xml - name: Upload Coverage to Codecov uses: codecov/codecov-action@v4.0.1 From c31c32b08ed21934aed1f31c23b8513e50d53067 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:15:00 +0300 Subject: [PATCH 35/44] Add python -m on pytest --- .github/workflows/macos-tests-3.12.yml | 4 ++-- .github/workflows/macos-tests-3.8.yml | 2 +- .github/workflows/ubuntu-tests-3.8.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml index aeaf295..ae65612 100644 --- a/.github/workflows/macos-tests-3.12.yml +++ b/.github/workflows/macos-tests-3.12.yml @@ -18,7 +18,7 @@ jobs: pip install setuptools twine wheel python -m pip install . - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | - cd tests/unit && pytest --cov=../../ + cd tests/unit && python -m pytest --cov=../../ diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index da2f1de..9e3aa92 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -21,7 +21,7 @@ jobs: WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Generate Coverage Report run: | pip install pytest pytest-cov diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index 0978109..6ad7ba2 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -21,7 +21,7 @@ jobs: WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - name: Download dependencies - run: pip install setuptools && pip install . + run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && python -m unittest discover -s . -p "*.py" From 0131e46384e741179502d91e82b691b2c8c9ef0e Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:18:40 +0300 Subject: [PATCH 36/44] Minor changes --- .github/workflows/macos-tests-3.12.yml | 2 -- .github/workflows/macos-tests-3.8.yml | 2 -- .github/workflows/ubuntu-tests-3.12.yml | 2 -- .github/workflows/ubuntu-tests-3.8.yml | 2 -- 4 files changed, 8 deletions(-) diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml index ae65612..6fa0c74 100644 --- a/.github/workflows/macos-tests-3.12.yml +++ b/.github/workflows/macos-tests-3.12.yml @@ -17,8 +17,6 @@ jobs: python -m pip cache purge pip install setuptools twine wheel python -m pip install . - - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && python -m pytest --cov=../../ diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index 9e3aa92..5658b86 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -20,8 +20,6 @@ jobs: cd dist WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt - name: Generate Coverage Report run: | pip install pytest pytest-cov diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index b0f51cb..4badd0d 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -17,8 +17,6 @@ jobs: python -m pip cache purge pip install setuptools twine wheel python -m pip install . - - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index 6ad7ba2..ab66c74 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -20,8 +20,6 @@ jobs: cd dist WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install -r dev-dependencies.txt - name: Run unit tests run: | cd tests/unit && python -m unittest discover -s . -p "*.py" From bba047c5bc7681f42350c2b48983b5db1a84c514 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:21:24 +0300 Subject: [PATCH 37/44] re-add pytest --- .github/workflows/macos-tests-3.12.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml index 6fa0c74..c38e14f 100644 --- a/.github/workflows/macos-tests-3.12.yml +++ b/.github/workflows/macos-tests-3.12.yml @@ -19,4 +19,5 @@ jobs: python -m pip install . - name: Run unit tests run: | - cd tests/unit && python -m pytest --cov=../../ + pip install pytest pytest-cov + cd tests/unit && pytest --cov=../../ From 9744926abf81a79da7690816073d495ac96023a4 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:47:13 +0300 Subject: [PATCH 38/44] Add requirements.txt to every action --- .github/workflows/macos-tests-3.12.yml | 1 + .github/workflows/macos-tests-3.8.yml | 1 + .github/workflows/ubuntu-tests-3.12.yml | 1 + .github/workflows/ubuntu-tests-3.8.yml | 1 + dev-dependencies.txt => requirements.txt | 0 5 files changed, 4 insertions(+) rename dev-dependencies.txt => requirements.txt (100%) diff --git a/.github/workflows/macos-tests-3.12.yml b/.github/workflows/macos-tests-3.12.yml index c38e14f..aebcadf 100644 --- a/.github/workflows/macos-tests-3.12.yml +++ b/.github/workflows/macos-tests-3.12.yml @@ -15,6 +15,7 @@ jobs: - name: Install spare scores run: | python -m pip cache purge + pip install -r requirements.txt pip install setuptools twine wheel python -m pip install . - name: Run unit tests diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index 5658b86..ca9808b 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -15,6 +15,7 @@ jobs: - name: Install spare scores run: | python -m pip cache purge + pip install -r requirements.txt pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/.github/workflows/ubuntu-tests-3.12.yml b/.github/workflows/ubuntu-tests-3.12.yml index 4badd0d..04f78ea 100644 --- a/.github/workflows/ubuntu-tests-3.12.yml +++ b/.github/workflows/ubuntu-tests-3.12.yml @@ -15,6 +15,7 @@ jobs: - name: Install spare scores run: | python -m pip cache purge + pip install -r requirements.txt pip install setuptools twine wheel python -m pip install . - name: Run unit tests diff --git a/.github/workflows/ubuntu-tests-3.8.yml b/.github/workflows/ubuntu-tests-3.8.yml index ab66c74..0c6b9ba 100644 --- a/.github/workflows/ubuntu-tests-3.8.yml +++ b/.github/workflows/ubuntu-tests-3.8.yml @@ -15,6 +15,7 @@ jobs: - name: Install spare scores run: | python -m pip cache purge + pip install -r requirements.txt pip install setuptools twine wheel python setup.py bdist_wheel cd dist diff --git a/dev-dependencies.txt b/requirements.txt similarity index 100% rename from dev-dependencies.txt rename to requirements.txt From 213ed2fa631ca4b3e6e0fd695b8787414e8a8cf3 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:49:54 +0300 Subject: [PATCH 39/44] Change matplotlib version to 3.7.5 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2a90574..7676074 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ iniconfig==2.0.0 joblib==1.3.1 jsonschema==4.17.3 kiwisolver==1.4.4 -matplotlib==3.8.0 +matplotlib==3.7.5 msgpack==1.0.5 numpy==1.26.4 packaging==23.1 From 50c7ec8fa22ff0dbb44af10f3d17b845bea855e9 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:53:42 +0300 Subject: [PATCH 40/44] Change numpy version to 1.24.4 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7676074..833afe4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ jsonschema==4.17.3 kiwisolver==1.4.4 matplotlib==3.7.5 msgpack==1.0.5 -numpy==1.26.4 +numpy==1.24.4 packaging==23.1 pandas==2.2.2 Pillow==9.5.0 From ee6783fb77f92c17ec39f87b5e24256cc39db1b7 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 19:55:16 +0300 Subject: [PATCH 41/44] Change requirements --- requirements.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 833afe4..d12df9f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ attrs==23.1.0 certifi==2023.5.7 charset-normalizer==3.1.0 click==8.1.3 +# contourpy==1.2.1 cycler==0.11.0 exceptiongroup==1.1.1 filelock==3.12.2 @@ -15,29 +16,29 @@ iniconfig==2.0.0 joblib==1.3.1 jsonschema==4.17.3 kiwisolver==1.4.4 -matplotlib==3.7.5 +matplotlib==3.9.0 msgpack==1.0.5 -numpy==1.24.4 +numpy==1.22.0 packaging==23.1 -pandas==2.2.2 +pandas==2.2.0 Pillow==9.5.0 pkgutil_resolve_name==1.3.10 pluggy==1.5.0 +protobuf==4.23.3 pyparsing==3.1.0 pyrsistent==0.19.3 pytest==8.2.2 -pytest-cov==5.0.0 python-dateutil==2.8.2 pytz==2023.3 PyYAML==6.0.2 ray==2.34.0 requests==2.31.0 -scikit-learn==1.5.0 +scikit-learn==1.0.1 scipy==1.14.0 six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.2.1 +torch==2.2.0 torchvision==0.17.1 typing_extensions==4.8.0 tzdata==2023.3 From 5b03445e14986d072c52ea2710417981dd49e0ff Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 20:08:58 +0300 Subject: [PATCH 42/44] Reevaluated requirements --- requirements.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index d12df9f..229043e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,11 +16,11 @@ iniconfig==2.0.0 joblib==1.3.1 jsonschema==4.17.3 kiwisolver==1.4.4 -matplotlib==3.9.0 +matplotlib==3.7.5 msgpack==1.0.5 numpy==1.22.0 packaging==23.1 -pandas==2.2.0 +pandas==2.0.3 Pillow==9.5.0 pkgutil_resolve_name==1.3.10 pluggy==1.5.0 @@ -31,14 +31,13 @@ pytest==8.2.2 python-dateutil==2.8.2 pytz==2023.3 PyYAML==6.0.2 -ray==2.34.0 requests==2.31.0 -scikit-learn==1.0.1 -scipy==1.14.0 +scikit-learn==1.3.2 +scipy==1.10.1 six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.2.0 +torch==2.2.1 torchvision==0.17.1 typing_extensions==4.8.0 tzdata==2023.3 From d2e6378c5daf93117aa91757f5b00580fd927e18 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 20:27:17 +0300 Subject: [PATCH 43/44] Changed requirements for different python versions --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 229043e..6eaf6a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ jsonschema==4.17.3 kiwisolver==1.4.4 matplotlib==3.7.5 msgpack==1.0.5 -numpy==1.22.0 +numpy packaging==23.1 pandas==2.0.3 Pillow==9.5.0 @@ -33,7 +33,7 @@ pytz==2023.3 PyYAML==6.0.2 requests==2.31.0 scikit-learn==1.3.2 -scipy==1.10.1 +scipy six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 From bae560aab64f1e48e52f92de0bb82ac98a1117c9 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 2 Sep 2024 21:43:38 +0300 Subject: [PATCH 44/44] minor change in codecov to upload correctly --- .github/workflows/macos-tests-3.8.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos-tests-3.8.yml b/.github/workflows/macos-tests-3.8.yml index ca9808b..08c3735 100644 --- a/.github/workflows/macos-tests-3.8.yml +++ b/.github/workflows/macos-tests-3.8.yml @@ -1,4 +1,4 @@ -name: macos build python=3.8 +name: macos tests python=3.8 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] @@ -12,18 +12,28 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.8" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.8 + - name: Install pip + run: conda run -n spare conda install pip - name: Install spare scores run: | - python -m pip cache purge - pip install -r requirements.txt pip install setuptools twine wheel python setup.py bdist_wheel cd dist WHEEL_FILE=$(ls spare_scores*) pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . - name: Generate Coverage Report run: | - pip install pytest pytest-cov + pip install pytest-cov cd tests/unit && pytest --cov=../../ --cov-report=xml - name: Upload Coverage to Codecov uses: codecov/codecov-action@v4.0.1