From ff8ff257309765319564f30484fdd8aff323532f Mon Sep 17 00:00:00 2001 From: Alessandro Daducci Date: Wed, 13 Aug 2025 13:50:56 +0200 Subject: [PATCH 1/2] Replaced get_distribution function to retrieve version --- amico/core.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/amico/core.py b/amico/core.py index 07ac65c..7be0af7 100644 --- a/amico/core.py +++ b/amico/core.py @@ -17,7 +17,6 @@ import dipy.reconst.dti as dti from amico.util import PRINT, LOG, WARNING, ERROR, get_verbose from dicelib.ui import ProgressBar -from pkg_resources import get_distribution from threadpoolctl import ThreadpoolController def setup( lmax=12 ) : @@ -74,7 +73,8 @@ def __init__( self, study_path='.', subject='.', output_path=None ) : # store all the parameters of an evaluation with AMICO self.CONFIG = {} - self.set_config('version', get_distribution('dmri-amico').version) + from . import __version__ as version + self.set_config('version', version) self.set_config('study_path', study_path) self.set_config('subject', subject) self.set_config('DATA_path', pjoin( study_path, subject )) @@ -312,7 +312,7 @@ def set_solver( self, **params ) : """ if self.model is None : ERROR( 'Model not set; call "set_model()" method first' ) - + solver_params = list(inspect.signature(self.model.set_solver).parameters) params_new = {} for key in params.keys(): @@ -344,7 +344,7 @@ def generate_kernels( self, regenerate = False, lmax = 12, ndirs = 500 ) : ERROR( 'Model not set; call "set_model()" method first' ) if not is_valid(ndirs): ERROR( 'Unsupported value for ndirs.\nNote: Supported values for ndirs are [1, 500 (default), 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000, 32761]' ) - + self.BLAS_nthreads = self.get_config('BLAS_nthreads') if self.get_config('BLAS_nthreads') > 0 else cpu_count() if self.get_config('BLAS_nthreads') == -1 else ERROR('Number of BLAS threads must be positive or -1') # store some values for later use @@ -385,7 +385,7 @@ def load_kernels( self ) : ERROR( 'Model not set; call "set_model()" method first' ) if self.scheme is None : ERROR( 'Scheme not loaded; call "load_data()" first' ) - + self.BLAS_nthreads = self.get_config('BLAS_nthreads') if self.get_config('BLAS_nthreads') > 0 else cpu_count() if self.get_config('BLAS_nthreads') == -1 else ERROR('Number of BLAS threads must be positive or -1') tic = time.time() @@ -418,7 +418,7 @@ def fit( self ) : ERROR( 'Response functions were not created with the same model' ) if self.get_config('DTI_fit_method') not in ['OLS', 'LS', 'WLS', 'NLLS', 'RT', 'RESTORE', 'restore']: ERROR("DTI fit method must be one of the following:\n'OLS'(default) or 'LS': ordinary least squares\n'WLS': weighted least squares\n'NLLS': non-linear least squares\n'RT' or 'RESTORE' or 'restore': robust tensor\nNOTE: more info at https://dipy.org/documentation/1.6.0./reference/dipy.reconst/#dipy.reconst.dti.TensorModel") - + self.nthreads = self.get_config('nthreads') if self.get_config('nthreads') > 0 else cpu_count() if self.get_config('nthreads') == -1 else ERROR('Number of parallel threads must be positive or -1') self.BLAS_nthreads = self.get_config('BLAS_nthreads') if self.get_config('BLAS_nthreads') > 0 else cpu_count() if self.get_config('BLAS_nthreads') == -1 else ERROR('Number of BLAS threads must be positive or -1') From b68d36880c893392f6b065bca1f9a1c7cb550b65 Mon Sep 17 00:00:00 2001 From: Alessandro Daducci Date: Wed, 13 Aug 2025 13:58:46 +0200 Subject: [PATCH 2/2] Updated version and CHANGELOG --- CHANGELOG.md | 7 +++++++ setup.cfg | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a37735f..13354d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log ### All notable changes to `AMICO` will be documented in this file. +## `v2.1.1`
_2025-08-13_ +### 🐛Fixed +- `UserWarning`: `pkg_resources` is deprecated as an API. + +--- +--- + ## `v2.1.0`
_2025-01-20_ ### 🛠️Changed - Support for `numpy>=2.0.0` diff --git a/setup.cfg b/setup.cfg index fd9da4b..08d7be4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = dmri-amico -version = 2.1.0 +version = 2.1.1 url = https://github.com/daducci/AMICO download_url = https://pypi.org/project/dmri-amico project_urls =