From 383e880e03f9d3cc1dadf064b04eb067123bc6ad Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:16:18 -0400 Subject: [PATCH 1/3] Explicit notification (#492) * explicit email notify * update trigger * Update .github/workflows/dailies.yml Co-authored-by: Steph Prince <40640337+stephprince@users.noreply.github.com> --------- Co-authored-by: Steph Prince <40640337+stephprince@users.noreply.github.com> --- .github/workflows/dailies.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dailies.yml b/.github/workflows/dailies.yml index 4518ff772..0a579039a 100644 --- a/.github/workflows/dailies.yml +++ b/.github/workflows/dailies.yml @@ -26,8 +26,8 @@ jobs: notify: runs-on: ubuntu-latest - needs: [run-daily-tests, run-daily-doc-link-checks] - if: ${{ always() && contains(needs.*.result, 'failure') }} + needs: [run-daily-tests, run-daily-doc-link-checks, test-dandi-latest, test-dandi-dev, test-dandi-dev-live] + if: failure() steps: - uses: dawidd6/action-send-mail@v3 with: @@ -36,6 +36,6 @@ jobs: username: ${{ secrets.MAIL_USERNAME }} password: ${{ secrets.MAIL_PASSWORD }} subject: NWB Inspector Daily Failure - to: ${{ secrets.DAILY_FAILURE_EMAIL_LIST }} # add more with commas, no separation + to: cody.c.baker.phd@gmail.com,smprince@lbl.gov from: NWB Inspector body: "The daily workflow for the NWB Inspector failed: please check status at https://github.com/NeurodataWithoutBorders/nwbinspector/actions/workflows/dailies.yml" From fb4e3896ce1c99f430f2d8067bf7dd5bfdf0ec28 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Fri, 30 Aug 2024 21:37:05 -0400 Subject: [PATCH 2/3] Fix import (#494) * fix a missing import * mix imports and naming consistency --- src/nwbinspector/_inspection_cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nwbinspector/_inspection_cli.py b/src/nwbinspector/_inspection_cli.py index 2f1668137..052df6767 100644 --- a/src/nwbinspector/_inspection_cli.py +++ b/src/nwbinspector/_inspection_cli.py @@ -9,8 +9,8 @@ import click -from ._formatting import _get_report_header -from . import Importance, inspect_all, format_messages, print_to_console, save_report, __version__ +from ._formatting import _get_report_header, InspectorOutputJSONEncoder +from . import Importance, inspect_all, format_messages, print_to_console, save_report, __version__, load_config from .utils import strtobool @@ -140,4 +140,4 @@ def _inspect_all_cli( if __name__ == "__main__": - inspect_all_cli() + _inspect_all_cli() From 910cebae7e8b500187d1bca81ec8ec19fa02bc9b Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Sat, 31 Aug 2024 09:44:09 -0400 Subject: [PATCH 3/3] Setup initial ruff (#496) * Update .pre-commit-config.yaml * select f401 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add some ignores, fix some others * testing * clarify remaining improperly scoped (and deprecated) inits * include require imports * restore required magic import for docs * Update CHANGELOG.md --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 6 ++++++ CHANGELOG.md | 9 +++++++++ pyproject.toml | 21 +++++++++++++++++++++ src/nwbinspector/__init__.py | 1 + src/nwbinspector/_configuration.py | 4 +--- src/nwbinspector/_registration.py | 3 --- src/nwbinspector/_types.py | 7 ------- 7 files changed, 38 insertions(+), 13 deletions(-) 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: 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) diff --git a/pyproject.toml b/pyproject.toml index 9f18a76f8..9231896ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,27 @@ extend-exclude = ''' )/ ''' + + +[tool.ruff] +exclude = ["docs/*"] + +[tool.ruff.lint] +select = ["F401", "I002"] # TODO: eventually, expand to other 'I', 'D', and other 'F' linting +fixable = ["ALL"] + +[tool.ruff.lint.per-file-ignores] +"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] skip = '.git*,*.pdf,*.css' check-hidden = true 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", 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..6e920a965 100644 --- a/src/nwbinspector/_types.py +++ b/src/nwbinspector/_types.py @@ -1,16 +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): """A definition of the valid importance levels for a given check function."""