Skip to content

Commit 1e79970

Browse files
committed
[api] Add backwards compat. helpers to avoid breaking imports
1 parent 287b548 commit 1e79970

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

scenedetect/frame_timecode.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# PySceneDetect: Python-Based Video Scene Detector
3+
# -------------------------------------------------------------------
4+
# [ Site: https://scenedetect.com ]
5+
# [ Docs: https://scenedetect.com/docs/ ]
6+
# [ Github: https://github.com/Breakthrough/PySceneDetect/ ]
7+
#
8+
# Copyright (C) 2014-2025 Brandon Castellano <http://www.bcastell.com>.
9+
# PySceneDetect is licensed under the BSD 3-Clause License; see the
10+
# included LICENSE file, or visit one of the above pages for details.
11+
#
12+
"""DEPRECATED"""
13+
14+
import warnings
15+
16+
warnings.warn(
17+
"The `frame_timecode` submodule is deprecated, import from the base package instead.",
18+
DeprecationWarning,
19+
stacklevel=2,
20+
)
21+
22+
from scenedetect.common import * # noqa: E402, F403

scenedetect/scene_detector.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# PySceneDetect: Python-Based Video Scene Detector
3+
# -------------------------------------------------------------------
4+
# [ Site: https://scenedetect.com ]
5+
# [ Docs: https://scenedetect.com/docs/ ]
6+
# [ Github: https://github.com/Breakthrough/PySceneDetect/ ]
7+
#
8+
# Copyright (C) 2014-2025 Brandon Castellano <http://www.bcastell.com>.
9+
# PySceneDetect is licensed under the BSD 3-Clause License; see the
10+
# included LICENSE file, or visit one of the above pages for details.
11+
#
12+
"""DEPRECATED"""
13+
14+
import warnings
15+
16+
warnings.warn(
17+
"The `scene_detector` submodule is deprecated, import from the base package instead.",
18+
DeprecationWarning,
19+
stacklevel=2,
20+
)
21+
22+
from scenedetect.detector import * # noqa: E402, F403

tests/test_detectors.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,12 @@ def test_detectors_with_stats(test_video_file):
224224
scene_manager.detect_scenes(video=video, end_time=end_time)
225225
scene_list = scene_manager.get_scene_list()
226226
assert len(scene_list) == initial_scene_len
227+
228+
229+
# TODO(v0.8): Remove this test during the removal of `scenedetect.scene_detector`.
230+
def test_deprecated_detector_module_emits_warning_on_import():
231+
SCENE_DETECTOR_WARNING = (
232+
"The `scene_detector` submodule is deprecated, import from the base package instead."
233+
)
234+
with pytest.warns(DeprecationWarning, match=SCENE_DETECTOR_WARNING):
235+
from scenedetect.scene_detector import SceneDetector as _

tests/test_timecode.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,12 @@ def test_precision():
300300
assert FrameTimecode(990, fps).get_timecode(precision=1, use_rounding=False) == "00:00:00.9"
301301
assert FrameTimecode(990, fps).get_timecode(precision=0, use_rounding=True) == "00:00:01"
302302
assert FrameTimecode(990, fps).get_timecode(precision=0, use_rounding=False) == "00:00:00"
303+
304+
305+
# TODO(v0.8): Remove this test during the removal of `scenedetect.scene_detector`.
306+
def test_deprecated_timecode_module_emits_warning_on_import():
307+
FRAME_TIMECODE_WARNING = (
308+
"The `frame_timecode` submodule is deprecated, import from the base package instead."
309+
)
310+
with pytest.warns(DeprecationWarning, match=FRAME_TIMECODE_WARNING):
311+
from scenedetect.frame_timecode import FrameTimecode as _

0 commit comments

Comments
 (0)