From 68a062721144a60f0b51108c19aaf759158ec979 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:48:28 -0400 Subject: [PATCH] Final deprecation of `insect_nwb` (#505) * final deprecation * changelog * remove from docs and soft deprecated submodule --------- Co-authored-by: CodyCBakerPhD --- CHANGELOG.md | 6 ++++ docs/user_guide/using_the_library.rst | 4 +-- .../user_guide/using_the_library_advanced.rst | 10 +++--- src/nwbinspector/__init__.py | 2 -- src/nwbinspector/_nwb_inspection.py | 32 ------------------- src/nwbinspector/nwbinspector/__init__.py | 1 - 6 files changed, 13 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3d243ec0..ad94e109a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Upcoming +### Deprecation (API) +* The `inspect_nwb` method has been removed. Please use `inspect_nwbfile` or `inspect_nwbfile_object` instead. [#505](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/505) + + + + # v0.5.2 ### Deprecation (API) diff --git a/docs/user_guide/using_the_library.rst b/docs/user_guide/using_the_library.rst index 6efa2e8fc..d7767938b 100644 --- a/docs/user_guide/using_the_library.rst +++ b/docs/user_guide/using_the_library.rst @@ -22,7 +22,7 @@ Inspect a single NWBFile ------------------------ The most basic function to use when inspecting a single NWB file is the -:py:class:`~nwbinspector.nwbinspector.inspect_nwb` function. +:py:class:`~nwbinspector.nwbinspector.inspect_nwbfile` function. .. code-block:: python @@ -65,7 +65,7 @@ function. all_results = list(inspect_all(path=file_paths_or_folder, ...)) -This has the same return structure as :py:class:`~nwbinspector.nwbinspector.inspect_nwb`. +This has the same return structure as :py:class:`~nwbinspector.nwbinspector.inspect_nwbfile`. .. note:: diff --git a/docs/user_guide/using_the_library_advanced.rst b/docs/user_guide/using_the_library_advanced.rst index 5cef68cc2..0eb3fd995 100644 --- a/docs/user_guide/using_the_library_advanced.rst +++ b/docs/user_guide/using_the_library_advanced.rst @@ -7,10 +7,10 @@ This is a collection of tutorials illustrating some of the more advanced uses of Yielding and Iterating ---------------------- -Both the :py:class:`~nwbinspector.nwbinspector.inspect_all` and :py:class:`~nwbinspector.nwbinspector.inspect_nwb` +Both the :py:class:`~nwbinspector.nwbinspector.inspect_all` and :py:class:`~nwbinspector.nwbinspector.inspect_nwbfile` functions return generators. That is, they do not actually run any checks on any NWBFile until the user performs an iteration command on them. The simplest way of doing this is to cast the generator as a ``list``, -*i.e.*, ``list(inspect_nwb(...))`` which will automatically complete all checks. +*i.e.*, ``list(inspect_nwbfile(...))`` which will automatically complete all checks. However, if a user chooses, they can harness these generators in more sophisticated ways. If you want to stop the checks early, the following will run the inspectors until the first @@ -18,7 +18,7 @@ checks early, the following will run the inspectors until the first .. code-block:: python - results_generator = inspect_nwb(nwbfile_path="path_to_single_nwbfile") + results_generator = inspect_nwbfile(nwbfile_path="path_to_single_nwbfile") first_message = next(results_generator) @@ -27,7 +27,7 @@ This will return either the first :py:class:`~nwbinspector.register_checks.Inspe .. code-block:: python - results_generator = inspect_nwb(nwbfile_path="path_to_single_nwbfile") + results_generator = inspect_nwbfile(nwbfile_path="path_to_single_nwbfile") try: first_message = next(results_generator) @@ -38,7 +38,7 @@ Of course, the generator can be treated like any other iterable as well, such as .. code-block:: python - results_generator = inspect_nwb(nwbfile_path="path_to_single_nwbfile") + results_generator = inspect_nwbfile(nwbfile_path="path_to_single_nwbfile") for message in results_generator: print(message) diff --git a/src/nwbinspector/__init__.py b/src/nwbinspector/__init__.py index 20d81ee1c..0c403bd34 100644 --- a/src/nwbinspector/__init__.py +++ b/src/nwbinspector/__init__.py @@ -8,7 +8,6 @@ inspect_nwbfile_object, run_checks, ) -from ._nwb_inspection import inspect_nwb # TODO: remove after 7/1/2023 from ._formatting import ( format_messages, print_to_console, @@ -40,7 +39,6 @@ "inspect_all", "inspect_nwbfile", "inspect_nwbfile_object", - "inspect_nwb", # TODO: remove after 7/1/2023 "run_checks", "format_messages", "print_to_console", diff --git a/src/nwbinspector/_nwb_inspection.py b/src/nwbinspector/_nwb_inspection.py index a68a4ce36..e4da1d5db 100644 --- a/src/nwbinspector/_nwb_inspection.py +++ b/src/nwbinspector/_nwb_inspection.py @@ -205,38 +205,6 @@ def _pickle_inspect_nwb( return list(inspect_nwbfile(nwbfile_path=nwbfile_path, checks=checks, skip_validate=skip_validate)) -# TODO: remove after 7/1/2023 -def inspect_nwb( - nwbfile_path: FilePathType, - checks: list = available_checks, - config: dict = None, - ignore: OptionalListOfStrings = None, - select: OptionalListOfStrings = None, - importance_threshold: Union[str, Importance] = Importance.BEST_PRACTICE_SUGGESTION, - driver: Optional[str] = None, - skip_validate: bool = False, - max_retries: int = 10, -) -> Iterable[InspectorMessage]: - warn( - "The API function 'inspect_nwb' has been deprecated and will be removed in a future release! " - "To remove ambiguity, please call either " - "'inspect_nwbfile' giving a path to the unopened file on a system, or " - "'inspect_nwbfile_object' passing an already open pynwb.NWBFile object.", - category=DeprecationWarning, - stacklevel=2, - ) - for inspector_message in inspect_nwbfile( - nwbfile_path=nwbfile_path, - checks=checks, - config=config, - ignore=ignore, - select=select, - importance_threshold=importance_threshold, - skip_validate=skip_validate, - ): - yield inspector_message - - def inspect_nwbfile( nwbfile_path: FilePathType, driver: Optional[str] = None, # TODO: remove after 3/1/2025 diff --git a/src/nwbinspector/nwbinspector/__init__.py b/src/nwbinspector/nwbinspector/__init__.py index fe2e1a9f1..3c2b419fb 100644 --- a/src/nwbinspector/nwbinspector/__init__.py +++ b/src/nwbinspector/nwbinspector/__init__.py @@ -18,7 +18,6 @@ ) from .._nwb_inspection import ( inspect_all, - inspect_nwb, # TODO: remove inspect_nwbfile, inspect_nwbfile_object, run_checks,