Visitar URL original
Matplotlib v3.9 compatibility by C-Achard · Pull Request #3394 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9cc1d18
Add Matplotlib colormap compatibility shim
C-Achard Jul 13, 2026
9518b9d
Allow custom warning stacklevel in deprecated
C-Achard Jul 13, 2026
bd7fdbb
Use shared get_colormap helper everywhere
C-Achard Jul 13, 2026
4bf4921
Merge branch 'main' into cy/init-mpl-version-change
C-Achard Jul 16, 2026
a5d5221
Merge remote-tracking branch 'upstream/main' into cy/init-mpl-version…
deruyter92 Aug 9, 2026
d5945cc
Fix get_colormap_names() legacy fallback to call _legacy_get_colormap…
deruyter92 Aug 9, 2026
d77d4f8
update version for "deprecated since .." warning
deruyter92 Aug 9, 2026
5e739e2
Add name override to deprecated() for legacy shim warnings
deruyter92 Aug 9, 2026
e6cfac6
Rename matplotlib_future_mode.py → matplotlib_compat.py
deruyter92 Aug 9, 2026
d9288fc
add tests for matplotlib compat layer
deruyter92 Aug 9, 2026
350e209
Import matplotlib.cm explicitly in the compat layer
C-Achard Sep 4, 2026
54ac2ac
Prevent duplicate legacy colormap registration
C-Achard Sep 4, 2026
b1c97fb
Route all plt.get_cmap calls throught the compat layer
C-Achard Sep 4, 2026
c1cf140
Use compat helper to clear matplotlib artists
C-Achard Sep 4, 2026
0e4a691
Patch matplotlib's Axes logger by name
C-Achard Sep 4, 2026
d3472c3
Test the name and stacklevel options of @deprecated
C-Achard Sep 4, 2026
0be8837
Expand matplotlib compat test coverage
C-Achard Sep 4, 2026
fe9d488
Remove unused compat helpers
C-Achard Sep 4, 2026
304bcc6
Remove unecessary tests
C-Achard Sep 4, 2026
aa007f6
Rename matplotlib compat module to utils
C-Achard Sep 4, 2026
0584d53
Replace matplotlib_compat colormap helpers
C-Achard Sep 4, 2026
1c15225
Simplify Matplotlib axes logger helper
C-Achard Sep 4, 2026
8a0ea71
Fix Matplotlib artist iteration
C-Achard Sep 4, 2026
426943f
Merge branch 'dev' into cy/init-mpl-version-change
deruyter92 Sep 8, 2026
31380eb
Merge branch 'dev' into cy/init-mpl-version-change
deruyter92 Sep 8, 2026
de29151
Merge branch 'dev' into cy/init-mpl-version-change
deruyter92 Sep 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow custom warning stacklevel in deprecated
Adds a `stacklevel` argument to `deeplabcut.core.deprecation.deprecated()` and uses it when emitting `DLCDeprecationWarning`. This keeps the default behavior (`stacklevel=2`) while allowing wrapper/legacy shim layers to bump the level so warnings point to the real caller.
  • Loading branch information
C-Achard committed Jul 13, 2026
commit 9518b9d78312da77e6391b0bf159e64f07e66a20
6 changes: 5 additions & 1 deletion deeplabcut/core/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def deprecated(
replacement: str | None = None,
since: str | None = None,
removed_in: str | None = None,
stacklevel: int = 2,
) -> Callable[[Callable[P, R]], Callable[P, R]]:
"""Mark a function as deprecated.

Expand All @@ -93,6 +94,9 @@ def deprecated(
``"deeplabcut.utils.auxfun_videos.list_videos_in_folder"``.
since: Version in which the function was deprecated.
removed_in: Version in which the function will be removed.
stacklevel: Stack level for the warning. Default is 2, which points to the
caller of the deprecated function. Increase this if you wrap calls in
an extra legacy wrapper function that you don't want to be blamed for the deprecation.
"""

def decorator(fn: Callable[P, R]) -> Callable[P, R]:
Expand All @@ -107,7 +111,7 @@ def decorator(fn: Callable[P, R]) -> Callable[P, R]:

@functools.wraps(fn)
def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
warnings.warn(message, DLCDeprecationWarning, stacklevel=2)
warnings.warn(message, DLCDeprecationWarning, stacklevel=stacklevel)
return fn(*args, **kwargs)

wrapper.__doc__ = f"Deprecated. {message}\n\n" + (fn.__doc__ or "")
Expand Down