From 961b7815c0a682b82da8b52ff576caecf4b79eba Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:20:48 -0500 Subject: [PATCH] Debug non-lazy ROIExtractors import (#733) --- .github/workflows/testing.yml | 9 +++++---- requirements-testing.txt | 1 - .../ophys/scanimage/scanimageimaginginterface.py | 7 ++++--- tests/imports.py | 10 ++++++++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index ad56fc21e..a2ddcffbc 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -41,7 +41,7 @@ jobs: - name: Install neuroconv with minimal requirements - run: pip install .[test] + run: pip install . - name: Run import tests run: | pytest tests/imports.py::TestImportStructure::test_top_level @@ -50,7 +50,8 @@ jobs: - name: Run minimal tests run: pytest tests/test_minimal -vv -rsx -n auto --dist loadscope - + - name: Install additional specific testing-only requirements + run: pip install .[test] - name: Install with ecephys requirements run: pip install .[ecephys] @@ -75,8 +76,8 @@ jobs: - - name: Install full requirements (-e needed for codecov report) - run: pip install -e .[full] + - name: Install full requirements + run: pip install -e .[full] # -e needed for codecov report diff --git a/requirements-testing.txt b/requirements-testing.txt index 007ed8352..6aa116be1 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -4,4 +4,3 @@ ndx-events>=0.2.0 # for special tests to ensure load_namespaces is set to allow parameterized>=0.8.1 ndx-miniscope spikeinterface[qualitymetrics]>=0.99.1 -roiextractors diff --git a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterface.py b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterface.py index eb44a9aad..cc12bc0af 100644 --- a/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterface.py +++ b/src/neuroconv/datainterfaces/ophys/scanimage/scanimageimaginginterface.py @@ -3,9 +3,6 @@ from typing import Optional from dateutil.parser import parse as dateparse -from roiextractors.extractors.tiffimagingextractors.scanimagetiff_utils import ( - extract_extra_metadata, -) from ..baseimagingextractorinterface import BaseImagingExtractorInterface from ....utils import FilePathType @@ -42,6 +39,10 @@ def __init__( The sampling frequency can usually be extracted from the scanimage metadata in exif:ImageDescription:state.acq.frameRate. If not, use this. """ + from roiextractors.extractors.tiffimagingextractors.scanimagetiff_utils import ( + extract_extra_metadata, + ) + self.image_metadata = extract_extra_metadata(file_path=file_path) if "state.acq.frameRate" in self.image_metadata: diff --git a/tests/imports.py b/tests/imports.py index a958d3340..0a10211c1 100644 --- a/tests/imports.py +++ b/tests/imports.py @@ -7,6 +7,8 @@ from unittest import TestCase +from neuroconv import BaseDataInterface + def _strip_magic_module_attributes(ls: list) -> list: exclude_keys = [ @@ -89,3 +91,11 @@ def test_datainterfaces(self): ] + interface_name_list assert sorted(current_structure) == sorted(expected_structure) + + +def test_datainterfaces_import(): + """Minimal installation should be able to import interfaces from the .datainterfaces submodule.""" + # Nothing special about SpikeGLX; just need to pick something to import to ensure a minimal install doesn't fail + from neuroconv.datainterfaces import SpikeGLXRecodingInterface + + assert isinstance(SpikeGLXRecodingInterface, BaseDataInterface)