From 66dcad493e8acdf6fe61b7face4fb255b8413241 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:20:54 -0400 Subject: [PATCH 1/2] method to import checks from any known extensions --- src/nwbinspector/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/nwbinspector/__init__.py b/src/nwbinspector/__init__.py index bad199d9b..01015b2f7 100644 --- a/src/nwbinspector/__init__.py +++ b/src/nwbinspector/__init__.py @@ -15,3 +15,12 @@ from .checks.icephys import * default_check_registry = {check.__name__: check for check in available_checks} + +# Automatically import from a set of known extensions that might be installed +import importlib + +KNOWN_EXTENSIONS = ["ndx_multichannel_volume"] +for extension_candidate in KNOWN_EXTENSIONS: + if importlib.util.find_spec(name=extension_candidate) is not None: + importlib.import_module(name=extension_candidate) + # Any checks exposed to the extension __init__ will now be registered From de7258219d277ae195ac1c107fdc4c40c87bed1d Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Sat, 20 Apr 2024 09:33:09 -0400 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32a13b50d..fd43468f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ * Fixed `--modules` flag in `nwbinspector` command line interface to allow for import of additional modules in the command line. This was necessary to be able to register new customized checks to the NWB Inspector. [#446](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/446) +### Improvements + +* Enabled auto-import of checks defined from a set of known extensions, beginning with `ndx_multichannel_volume`. [#447](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/447) + + + # v0.4.33 ### Fixes