Skip to content

Conversation

Jiaqi-Lv
Copy link
Collaborator

@Jiaqi-Lv Jiaqi-Lv commented May 9, 2025

Fix typing for files in tiatoolbox/wsicore/

  • tiatoolbox/wsicore/__init__.py
  • tiatoolbox/wsicore/wsimeta.py
  • tiatoolbox/wsicore/metadata/

Will work on tiatoolbox/wsicore/wsireader.py after #825

@Jiaqi-Lv Jiaqi-Lv added the dev tools Changes/Updates in Development tools label May 9, 2025
@Jiaqi-Lv Jiaqi-Lv self-assigned this May 9, 2025
Copy link

codecov bot commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.69%. Comparing base (c0da691) to head (435a34a).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #935   +/-   ##
========================================
  Coverage    99.69%   99.69%           
========================================
  Files           71       71           
  Lines         8934     8939    +5     
  Branches      1171     1170    -1     
========================================
+ Hits          8907     8912    +5     
  Misses          23       23           
  Partials         4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shaneahmed shaneahmed added this to the Release v1.7.0 milestone May 16, 2025
@shaneahmed
Copy link
Member

Pin tifffile <=v2025.5.10

@Jiaqi-Lv Jiaqi-Lv marked this pull request as ready for review May 23, 2025 14:14
@Jiaqi-Lv Jiaqi-Lv requested a review from Copilot May 29, 2025 15:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enable strict mypy type checking in the tiatoolbox/wsicore package by refining type hints, default values, and adding missing tests.

  • Refined wsimeta.py with explicit imports, default fallbacks, and enforced return types
  • Enhanced metadata/ngff.py by adding __iter__ to Multiscales and tightening Window field types
  • Added tests for non-tiled TIFF detection and Multiscales iteration; updated CI to include new files in mypy checks

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tiatoolbox/wsicore/wsimeta.py Added cast, defaulted level_downsamples, explicit returns, and refactored scale logic for typing
tiatoolbox/wsicore/metadata/ngff.py Implemented __iter__ on Multiscales, changed Window fields to int
tests/test_wsireader.py New test_is_not_tiled_tiff to cover non-tiled TIFF cases
tests/test_meta_ngff_dataclasses.py New test for Multiscales iteration order
.github/workflows/mypy-type-check.yml Included wsicore files and directories in mypy job
Comments suppressed due to low confidence (2)

tiatoolbox/wsicore/wsimeta.py:124

  • A default list of [1.0] is used when level_downsamples is None, but there are no tests verifying this fallback. Consider adding tests for this scenario.
else [1.0]

tiatoolbox/wsicore/wsimeta.py:275

  • The name 'Resolution' is not imported or defined, causing a NameError. Consider importing or defining the 'Resolution' type alias.
def np_pair(x: Resolution) -> np.ndarray:

shaneahmed and others added 4 commits May 30, 2025 13:06
# Conflicts:
#	.github/workflows/mypy-type-check.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@shaneahmed shaneahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Jiaqi-Lv

@shaneahmed shaneahmed merged commit b564590 into develop Jun 10, 2025
15 checks passed
@shaneahmed shaneahmed deleted the mypy-type-check-wsicore branch June 10, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev tools Changes/Updates in Development tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants