Skip to content

chore: remove workaround for bug in tiiffile squeeze for modern versions - #1463

Merged
Czaki merged 3 commits into
developfrom
fix_tiffile
Sep 17, 2026
Merged

Czaki merged 3 commits into
developfrom
fix_tiffile

Conversation

@Czaki

@Czaki Czaki commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Limit the tifffile squeeze workaround to versions that require it.

Bug Fixes:

  • Adjust tifffile image loading to avoid applying the squeeze workaround in versions 2026.9.9 and later.

Chores:

  • Update ignore configuration and refine tifffile version compatibility handling.

Summary by CodeRabbit

  • Bug Fixes

    • Improved TIFF image loading compatibility across supported versions of the TIFF reader, preventing issues caused by applying an outdated compatibility workaround to newer versions.
  • Chores

    • Updated project file exclusions to prevent an automatically generated dependency lock file from being tracked.

@sourcery-ai

sourcery-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR narrows the tifffile squeeze workaround to versions 2026.5.2 through 2026.9.8, reflecting the upstream fix in modern versions while retaining compatibility for affected releases; it also adds an ignored repository artifact.

Flow diagram for tifffile squeeze compatibility selection

flowchart TD
    A[tifffile version] --> B{Version >= 2026.5.2?}
    B -- No --> C[asarray with squeeze=None]
    B -- Yes --> D{Version < 2026.9.9?}
    D -- Yes --> E[asarray with squeeze=True]
    D -- No --> C
Loading

File-Level Changes

Change Details Files
Limit the tifffile squeeze workaround to the affected version range and use the updated condition when reading image data.
  • Require tifffile versions from 2026.5.2 inclusive through before 2026.9.9 for the workaround.
  • Pass the bounded condition to image_file.asarray(squeeze=...), preserving default behavior outside that range.
  • Rename the version flag to document both lower and upper bounds.
package/PartSegImage/image_reader.py
Update repository ignore rules.
  • Add the newly ignored path or artifact to the ignore configuration.
.gitignore

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d9a3ac9c-443b-4aea-b79d-852d5987869b

📥 Commits

Reviewing files that changed from the base of the PR and between 25695e6 and db3abaa.

📒 Files selected for processing (2)
  • .gitignore
  • package/PartSegImage/image_reader.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The pull request updates TIFF squeeze handling for a bounded tifffile version range and adds pixi.lock to .gitignore.

Changes

TIFF version gating

Layer / File(s) Summary
TIFF read version window
package/PartSegImage/image_reader.py
TiffImageReader.read passes squeeze=True for tifffile versions from 2026.5.2 through 2026.9.8. Later versions use the default behavior.

Pixi lockfile ignore rule

Layer / File(s) Summary
Ignore pixi.lock
.gitignore
The ignore rules now include pixi.lock.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to db3ab

The TIFF compatibility change aligns with tifffile 2026.9.9 behavior, and the ignore-rule update introduces no actionable risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the main change: removal of the tifffile squeeze workaround for modern versions. It contains a minor typo in “tiiffile,” but the meaning remains clear.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix_tiffile

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="package/PartSegImage/image_reader.py" line_range="468-469" />
<code_context>
             image_file.report_func = report_func
             try:
-                image_data = image_file.asarray(squeeze=TIFFFILE_GE_2026_5_2 or None)
+                image_data = image_file.asarray(squeeze=TIFFFILE_GE_2026_5_2_AND_LT_2026_9_9 or None)
                 # Since tifffile version 2026.5.2, the `image_file.series` is returned in squeezed format
                 # So we need squeezed array in such situation
</code_context>
<issue_to_address>
**nitpick:** The comment immediately below the changed call says that every tifffile version since 2026.5.2 requires a squeezed array, but the new condition deliberately passes `None` for versions 2026.9.9 and newer. This leaves an in-code explanation that contradicts the implemented version boundary and can cause the workaround to be incorrectly reintroduced or extended later.

**Suggested fix:** Update the comment to document the limited 2026.5.2 through 2026.9.8 compatibility range and explain that the workaround is no longer used from 2026.9.9 onward.

```suggestion
                # For tifffile versions 2026.5.2 through 2026.9.8, the `image_file.series` is returned in squeezed format
                # and we need a squeezed array; from version 2026.9.9 onward, this workaround is no longer used
```
</issue_to_address>

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread package/PartSegImage/image_reader.py Outdated
Czaki and others added 2 commits September 17, 2026 13:31
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@Czaki Czaki added this to the 0.17.1 milestone Sep 17, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.59%. Comparing base (25695e6) to head (db3abaa).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1463      +/-   ##
===========================================
- Coverage    92.61%   92.59%   -0.02%     
===========================================
  Files          211      211              
  Lines        33248    33248              
===========================================
- Hits         30792    30787       -5     
- Misses        2456     2461       +5     

☔ View full report in Codecov by Harness.
📢 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.

@Czaki
Czaki merged commit 0eee946 into develop Sep 17, 2026
54 of 55 checks passed
@Czaki
Czaki deleted the fix_tiffile branch September 17, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant