From 39d0aed5d94a664946ccc79c64ef91c9e78c87df Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Fri, 30 Aug 2024 21:30:52 -0400 Subject: [PATCH 01/10] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 213095446..cc3feb660 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,12 @@ repos: hooks: - id: black +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.2 + hooks: + - id: ruff + args: [ --fix ] + - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: From 3d52cfbbddba0e13d07f7993e890de609143f208 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Fri, 30 Aug 2024 21:31:53 -0400 Subject: [PATCH 02/10] select f401 --- pyproject.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9f18a76f8..1ffc2c1c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,16 @@ extend-exclude = ''' )/ ''' + + +[tool.ruff] + +[tool.ruff.lint] +select = ["F401"] # TODO: eventually, expand to other 'I', 'D', and other 'F' linting +fixable = ["ALL"] + + + [tool.codespell] skip = '.git*,*.pdf,*.css' check-hidden = true From a9349e870c1743bb1df9606a461ca733fdf47a7f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 31 Aug 2024 01:33:40 +0000 Subject: [PATCH 03/10] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/conf.py | 1 - src/nwbinspector/_configuration.py | 4 +--- src/nwbinspector/_registration.py | 3 --- src/nwbinspector/_types.py | 6 ------ 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 998c66e8d..5258530bc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,7 +6,6 @@ from collections import defaultdict sys.path.append(str(Path(__file__).parent)) -from conf_extlinks import extlinks, intersphinx_mapping sys.path.insert(0, Path(__file__).resolve().parents[1]) diff --git a/src/nwbinspector/_configuration.py b/src/nwbinspector/_configuration.py index 17daeca2e..24530f109 100644 --- a/src/nwbinspector/_configuration.py +++ b/src/nwbinspector/_configuration.py @@ -3,15 +3,13 @@ import json import jsonschema from pathlib import Path -from enum import Enum from typing import Optional, List from types import FunctionType -from packaging.version import Version import yaml from . import available_checks -from ._registration import InspectorMessage, Importance +from ._registration import Importance from nwbinspector.utils._utils import ( PathType, ) diff --git a/src/nwbinspector/_registration.py b/src/nwbinspector/_registration.py index 40ad7e734..e736301fc 100644 --- a/src/nwbinspector/_registration.py +++ b/src/nwbinspector/_registration.py @@ -1,9 +1,6 @@ """Primary decorator used on a check function to add it to the registry and automatically parse its output.""" -from collections.abc import Iterable from functools import wraps -from enum import Enum -from dataclasses import dataclass from typing import Optional import h5py diff --git a/src/nwbinspector/_types.py b/src/nwbinspector/_types.py index 623400f1c..aedbcc3e1 100644 --- a/src/nwbinspector/_types.py +++ b/src/nwbinspector/_types.py @@ -1,15 +1,9 @@ """Primary decorator used on a check function to add it to the registry and automatically parse its output.""" -from collections.abc import Iterable -from functools import wraps from enum import Enum from dataclasses import dataclass from typing import Optional -import h5py -from pynwb import NWBFile -from pynwb.file import Subject -from pynwb.ecephys import Device, ElectrodeGroup class Importance(Enum): From c167071e5d3a50a9a9df726c12515ad7bd9c3c52 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 31 Aug 2024 01:37:39 +0000 Subject: [PATCH 04/10] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/nwbinspector/_types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/nwbinspector/_types.py b/src/nwbinspector/_types.py index aedbcc3e1..6e920a965 100644 --- a/src/nwbinspector/_types.py +++ b/src/nwbinspector/_types.py @@ -5,7 +5,6 @@ from typing import Optional - class Importance(Enum): """A definition of the valid importance levels for a given check function.""" From 6bb1f046608f0f49dfecb2d212d2a084385e081b Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Fri, 30 Aug 2024 21:42:54 -0400 Subject: [PATCH 05/10] add some ignores, fix some others --- pyproject.toml | 4 ++++ src/nwbinspector/__init__.py | 1 + 2 files changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 1ffc2c1c4..b60538828 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,10 @@ extend-exclude = ''' select = ["F401"] # TODO: eventually, expand to other 'I', 'D', and other 'F' linting fixable = ["ALL"] +[tool.ruff.lint.per-file-ignores] +"nwbinspector/__init__.py" = ["I"] # Must maintain explicit order for imports for check registration +"nwbinspector/nwbinspector/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility +"nwbinspector/inspector_tools/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility [tool.codespell] diff --git a/src/nwbinspector/__init__.py b/src/nwbinspector/__init__.py index c8c2e181f..c7829fb1f 100644 --- a/src/nwbinspector/__init__.py +++ b/src/nwbinspector/__init__.py @@ -29,6 +29,7 @@ "Importance", "Severity", "InspectorMessage", + "validate_config", "load_config", "configure_checks", "InspectorOutputJSONEncoder", From 1fe04a72e036ca4ecc7c45028c78730b12e871f1 Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Fri, 30 Aug 2024 21:44:46 -0400 Subject: [PATCH 06/10] testing --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b60538828..50eb453c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,9 +30,9 @@ select = ["F401"] # TODO: eventually, expand to other 'I', 'D', and other 'F' li fixable = ["ALL"] [tool.ruff.lint.per-file-ignores] -"nwbinspector/__init__.py" = ["I"] # Must maintain explicit order for imports for check registration -"nwbinspector/nwbinspector/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility -"nwbinspector/inspector_tools/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility +"__init__.py" = ["I"] # Must maintain explicit order for imports for check registration +"nwbinspector/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility +"inspector_tools/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility [tool.codespell] From 4a9d04b8952be630e7ef48774fe4d878e2dc3c75 Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Fri, 30 Aug 2024 21:47:59 -0400 Subject: [PATCH 07/10] clarify remaining improperly scoped (and deprecated) inits --- pyproject.toml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 50eb453c7..cb6a42800 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,9 +30,15 @@ select = ["F401"] # TODO: eventually, expand to other 'I', 'D', and other 'F' li fixable = ["ALL"] [tool.ruff.lint.per-file-ignores] -"__init__.py" = ["I"] # Must maintain explicit order for imports for check registration -"nwbinspector/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility -"inspector_tools/__init__.py" = ["F401", "I"] # Temporarily keeping all exposure for back-compatibility +"src/nwbinspector/__init__.py" = ["I"] # Must maintain explicit order for imports for check registration +"src/nwbinspector/utils/__init__.py" = ["F401", "I"] # Several items planned for long-term deprecation + +# Temporarily keeping all exposure below for back-compatibility +# Deprecation scheduled for 9/15/2024 +"src/nwbinspector/nwbinspector/__init__.py" = ["F401", "I"] +"src/nwbinspector/inspector_tools/__init__.py" = ["F401", "I"] +"src/nwbinspector/version/__init__.py" = ["F401", "I"] +"src/nwbinspector/register_checks/__init__.py" = ["F401", "I"] [tool.codespell] From edb8f7999296a73d8baaab4f8ba1765fafa86cbf Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Fri, 30 Aug 2024 21:50:18 -0400 Subject: [PATCH 08/10] include require imports --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cb6a42800..5702459da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ extend-exclude = ''' [tool.ruff] [tool.ruff.lint] -select = ["F401"] # TODO: eventually, expand to other 'I', 'D', and other 'F' linting +select = ["F401", "I002"] # TODO: eventually, expand to other 'I', 'D', and other 'F' linting fixable = ["ALL"] [tool.ruff.lint.per-file-ignores] From c065d5258909db82a87e8f30156e789d10c85d56 Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Fri, 30 Aug 2024 21:59:06 -0400 Subject: [PATCH 09/10] restore required magic import for docs --- docs/conf.py | 1 + pyproject.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 5258530bc..998c66e8d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,6 +6,7 @@ from collections import defaultdict sys.path.append(str(Path(__file__).parent)) +from conf_extlinks import extlinks, intersphinx_mapping sys.path.insert(0, Path(__file__).resolve().parents[1]) diff --git a/pyproject.toml b/pyproject.toml index 5702459da..9231896ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ extend-exclude = ''' [tool.ruff] +exclude = ["docs/*"] [tool.ruff.lint] select = ["F401", "I002"] # TODO: eventually, expand to other 'I', 'D', and other 'F' linting From b85871f3f0daeeeadf5f6fc6653fb2441fe2cf3d Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:03:07 -0400 Subject: [PATCH 10/10] Update CHANGELOG.md --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb5b39ed..74a67246a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Upcoming +# v0.5.2 + +### Fixes + +* Fixed import error when using the CLI with `--config dandi`. [#494](https://github.com/NeurodataWithoutBorders/nwbinspector/issues/494) +* Removed unused imports throughout package. [#496](https://github.com/NeurodataWithoutBorders/nwbinspector/issues/496) + + + # v0.5.0 ### Deprecation (API)