You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add type annotations to lightly/utils/debug.py and tests/utils/test_debug.py
remove both files from the mypy exclusion list
improve optional matplotlib handling by keeping the pyplot module separate from import errors
remove an unused torchvision import
preserve the invalid-transform test with a targeted # type: ignore[arg-type]
Validation
make type-check
make format-check
uv run --frozen pytest tests/utils/test_debug.py — 11 passed
Add type annotations to lightly/utils/debug.py and tests/utils/test_debug.py. Remove both files from the mypy exclusion list. Keep Matplotlib import errors separate from pyplot, and retain the invalid-transform test with a targeted type ignore.
The author reports that type checks, formatting checks, and the debug utility tests passed (11 tests).
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 54e8eb66-de69-4897-8ee7-9e164d47e964
📥 Commits
Reviewing files that changed from the base of the PR and between c725399 and 0c966b1.
📒 Files selected for processing: 2
pyproject.toml
tests/utils/test_debug.py
💤 Files with no reviewable changes: 1
pyproject.toml
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
📝 Walkthrough
The debug utility stores Matplotlib import failures separately and retrieves pyplot when plotting. The changes add annotations to the plotting function, transform parameter, and tests. Mypy no longer excludes the utility or its tests.
Changes: Debug utility
Layer / File(s)
Summary
Pyplot import and plotting access lightly/utils/debug.py, tests/utils/test_debug.py
The module stores pyplot or its import error. The plotting function retrieves pyplot through a helper and uses it to create the figure and subplots. Tests check Matplotlib availability through importlib.
Transform annotations and type checking lightly/utils/debug.py, pyproject.toml, tests/utils/test_debug.py
The transform parameter gains an Any annotation, while the existing transform dispatch remains in place. Mypy exclusions are removed, and test helpers and methods gain annotations.
The optional Matplotlib behavior is preserved, and no actionable merge-blocking regression is established.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 2 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: adding type annotations to the debug utilities.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1635.
Summary
lightly/utils/debug.pyandtests/utils/test_debug.pytorchvisionimport# type: ignore[arg-type]Validation
make type-checkmake format-checkuv run --frozen pytest tests/utils/test_debug.py— 11 passedAdd type annotations to
lightly/utils/debug.pyandtests/utils/test_debug.py. Remove both files from the mypy exclusion list. Keep Matplotlib import errors separate frompyplot, and retain the invalid-transform test with a targeted type ignore.The author reports that type checks, formatting checks, and the debug utility tests passed (11 tests).