From 1c8e147ed1b3f317620f5599d35c044a0c6bd148 Mon Sep 17 00:00:00 2001 From: Richard Hakim Date: Wed, 31 Jan 2024 19:36:35 +0000 Subject: [PATCH 1/5] Increment version number --- roicat/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roicat/__init__.py b/roicat/__init__.py index 26b6e113..a23bbf4a 100644 --- a/roicat/__init__.py +++ b/roicat/__init__.py @@ -13,4 +13,4 @@ for pkg in __all__: exec('from . import ' + pkg) -__version__ = '1.1.30' +__version__ = '1.1.31' From 39868af755bf6834ed622286edd2b860256fbff9 Mon Sep 17 00:00:00 2001 From: RichieHakim Date: Wed, 31 Jan 2024 16:23:29 -0500 Subject: [PATCH 2/5] Update setup.py and test_packages.py --- setup.py | 5 ++- tests/test_packages.py | 90 +++++++++++++++++++++++------------------- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/setup.py b/setup.py index 0726423b..74448698 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def read_requirements(): # Operating system specific dependencies # OpenCV >= 4.9 is not supported on macOS < 12 system, version_macos = platform.system(), platform.mac_ver()[0] -print(f"System: {system}, macOS version: {version_macos}") +print(f"System: {system}") if (system == "Darwin"): # Safely convert version string components to integers version_parts = version_macos.split('.') @@ -48,6 +48,9 @@ def read_requirements(): print(f"Detected macOS version {version_major_macos}, which is < 12. Installing an older version of OpenCV: {version_opencv_macos_sub12}") deps_all_dict['opencv_contrib_python'] = version_opencv_macos_sub12 deps_all_latest['opencv_contrib_python'] = version_opencv_macos_sub12 +import re +## find the numbers in the string +version_opencv = '.'.join(re.findall(r'[0-9]+', deps_all_dict['opencv_contrib_python'])) ## Make different versions of dependencies diff --git a/tests/test_packages.py b/tests/test_packages.py index c9fc1ae4..1c66f5c2 100644 --- a/tests/test_packages.py +++ b/tests/test_packages.py @@ -1,6 +1,40 @@ import warnings +PACKAGES = [ + 'GPUtil', + 'PIL', + 'cpuinfo', + 'cv2', + 'jupyter', + 'mat73', + 'matplotlib', + 'natsort', + 'numpy', + 'onnx', + 'onnxruntime', + 'optuna', + 'psutil', + 'pytest', + 'scipy', + 'seaborn', + 'skl2onnx', + 'sklearn', + 'sparse', + 'torch', + 'torchaudio', + 'torchvision', + 'tqdm', + 'xxhash', + 'yaml', + 'bokeh', + 'holoviews', + 'jupyter_bokeh', + 'umap', + 'hdbscan', + 'kymatio', +] + def test_internal_package_tests(): """ Test packages. @@ -29,60 +63,34 @@ def test_internal_package_tests(): exec(f'import {pkg_s}') print(f'RH: Successfully imported {pkg_s}') except ImportError: - warnings.warn(f'RH: Could not import {pkg_s}.') + warnings.warn(f'RH: Could not import {pkg_s}. Skipping tests.') continue - ## Get a handle on the package - pkg_h = eval(pkg_s) + else: + try: + ## Get a handle on the package + pkg_h = eval(pkg_s) + + ## Get the path to the package + path_pkg = str(Path(pkg_h.__file__).parent) - ## Get the path to the package - path_pkg = str(Path(pkg_h.__file__).parent) + ## Run the tests + pytest.main([path_pkg, '-v']) + except Exception as e: + warnings.warn(f'RH: Could not run tests for {pkg_s}. Error: {e}') + continue - ## Run the tests - pytest.main([path_pkg, '-v']) def test_importing_packages(): """ Runs pytest on the core packages. """ - corePackages = [ - 'hdbscan', - 'holoviews', - 'jupyter', - 'kymatio', - 'matplotlib', - 'natsort', - 'numpy', - 'cv2', - 'optuna', - 'PIL', - 'pytest', - 'sklearn', - 'scipy', - 'seaborn', - 'sparse', - 'tqdm', - 'umap', - 'xxhash', - 'bokeh', - 'psutil', - 'cpuinfo', - 'GPUtil', - 'yaml', - 'mat73', - 'torch', - 'torchvision', - 'torchaudio', - 'skl2onnx', - 'onnx', - 'onnxruntime', - ] - for pkg in corePackages: + for pkg in PACKAGES: try: exec(f'import {pkg}') except ModuleNotFoundError: - warnings.warn(f'RH Warning: {pkg} not found. Skipping tests.') + warnings.warn(f'RH Warning: {pkg} not found.') def test_torch( device='cpu', From 75789036929f954a3ed09760ed21e1bfdd24bafd Mon Sep 17 00:00:00 2001 From: RichieHakim Date: Wed, 31 Jan 2024 16:24:11 -0500 Subject: [PATCH 3/5] remove all_latest and user from build runs (for main push) --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73e0bc20..bdc3902d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,11 +48,11 @@ jobs: ] extra: [ all, - all_latest, + # all_latest, ] install-level: [ system, - user, + # user, ] steps: From 6b6935d088cc62b44b146bb389f220012a7c91db Mon Sep 17 00:00:00 2001 From: RichieHakim Date: Wed, 31 Jan 2024 16:24:46 -0500 Subject: [PATCH 4/5] Remove unused commented code from tests package --- tests/__init__.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 25e0d8d4..e69de29b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,9 +0,0 @@ -# from os.path import dirname, basename, isfile, join -# import glob -# modules = glob.glob(join(dirname(__file__), "*.py")) -# __all__ = [ basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')] - -# for pkg in __all__: -# exec('from . import ' + pkg) - -# del dirname, basename, isfile, join, glob, modules, pkg \ No newline at end of file From 94099737d8b93cfc52f9fe5b0b4f994cf242d671 Mon Sep 17 00:00:00 2001 From: RichieHakim Date: Wed, 31 Jan 2024 16:25:11 -0500 Subject: [PATCH 5/5] Bumped up version to 1.1.32 --- roicat/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roicat/__init__.py b/roicat/__init__.py index a23bbf4a..d30982ba 100644 --- a/roicat/__init__.py +++ b/roicat/__init__.py @@ -13,4 +13,4 @@ for pkg in __all__: exec('from . import ' + pkg) -__version__ = '1.1.31' +__version__ = '1.1.32'