From 4d42540ad850ed13b915ec72a9ffc421023c9783 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Sun, 16 Feb 2025 10:46:17 -0800 Subject: [PATCH] Deprecate monitor.py (#1245) * Add DeprecationWarning to monitor.py * Fix syntax * Add warning test * Update changelog --- CHANGELOG.md | 5 +++++ src/hdmf/monitor.py | 8 ++++++++ tests/unit/test_monitor.py | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 tests/unit/test_monitor.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e3f480c8..4462ff604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # HDMF Changelog +## [Unreleased] + +### Changed +- `hdmf.monitor` is unused and undocumented. It has been deprecated and will be removed in HDMF 5.0. @rly [#1245](https://github.com/hdmf-dev/hdmf/pull/1245) + ## HDMF 4.0.0 (January 22, 2025) ### Breaking changes diff --git a/src/hdmf/monitor.py b/src/hdmf/monitor.py index 823ccf72d..9f8e7e0cc 100644 --- a/src/hdmf/monitor.py +++ b/src/hdmf/monitor.py @@ -1,8 +1,16 @@ from abc import ABCMeta, abstractmethod +import warnings from .data_utils import AbstractDataChunkIterator, DataChunkIterator, DataChunk from .utils import docval, getargs +warnings.warn( + "The hdmf.monitor module is deprecated and will be removed in HDMF 5.0. If you are using this module, " + "please copy this module to your codebase or raise an issue in the HDMF repository: " + "https://github.com/hdmf-dev/hdmf/issues", + DeprecationWarning, +) + class NotYetExhausted(Exception): pass diff --git a/tests/unit/test_monitor.py b/tests/unit/test_monitor.py new file mode 100644 index 000000000..f9af06a9c --- /dev/null +++ b/tests/unit/test_monitor.py @@ -0,0 +1,6 @@ +import pytest + + +def test_deprecation_warning(): + with pytest.warns(DeprecationWarning): + import hdmf.monitor # noqa: F401