diff --git a/CHANGELOG.md b/CHANGELOG.md index f3d243ec..ad94e109 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 6efa2e8f..d7767938 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 5cef68cc..0eb3fd99 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 20d81ee1..0c403bd3 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 a68a4ce3..e4da1d5d 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 fe2e1a9f..3c2b419f 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,