Skip to content

fix: Restore imagecodecs.jxr_decode alias for czifile <= 2019.7.2.2 - #1515

Merged
Czaki merged 2 commits into
developfrom
fix/czifile-imagecodecs-jxr-alias
Dec 1, 2026
Merged

Czaki merged 2 commits into
developfrom
fix/czifile-imagecodecs-jxr-alias

Conversation

@Czaki

@Czaki Czaki commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The conda-forge build of PartSeg 0.17.1 (conda-forge/partseg-feedstock#27) fails at import PartSegImage:

czifile/czifile.py:1284  DECOMPRESS[4] = imagecodecs.jxr_decode
AttributeError: module 'imagecodecs' has no attribute 'jxr_decode'. Did you mean: 'eer_decode'?

On Python 3.11, conda-forge only has czifile 2019.7.2.2, because every newer release requires Python >= 3.12. czifile 2019.7.2.3, which fixes this, is only on PyPI. czifile 2019.7.2.2 uses the deprecated imagecodecs.jxr_decode alias, and imagecodecs 2026.3.6 removed that alias from its _COMPATIBILITY table. Project CI doesn't catch this because it installs from PyPI: Python 3.11 gets czifile 2019.7.2.3, and Python 3.10 gets imagecodecs 2025.3.30, which still has the alias.

This PR restores imagecodecs.jxr_decode = imagecodecs.jpegxr_decode before czifile is imported. It only does so when czifile < 2019.7.2.3, the alias is missing, and jpegxr_decode is available.

Test plan

  • Reproduced the failure in a Python 3.11 venv with czifile==2019.7.2.2 and imagecodecs==2026.3.6. With the fix, the import works and DECOMPRESS[4] is imagecodecs.jpegxr_decode.
  • Existing CZI reader tests pass with the current czifile (2026.3.15).

Summary by Sourcery

Allow older czifile releases to import successfully with newer imagecodecs versions.

Bug Fixes:

  • Restore compatibility with czifile versions through 2019.7.2.2 when the installed imagecodecs release no longer provides the jxr_decode alias.

Chores:

  • Add a 0.17.2 changelog entry documenting the compatibility fix.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility when reading CZI images with older versions of image-processing libraries, including environments where JPEG XR decoding is available under a different name. This helps avoid image-reading issues across a broader range of supported library versions.

@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Implementation

Restore the missing JPEG XR compatibility alias for older czifile versions before importing czifile, preventing import failures with newer imagecodecs.

  • package/PartSegImage/czifile_fixes.py L8-22

Documentation

Add the 0.17.2 release notes documenting the czifile compatibility fix.

  • changelog.md L5-10

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 Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d210a86 and 6a41412.

Files selected for processing: 1

  • changelog.md

No actionable comments were generated in the recent review.

Walkthrough

The compatibility code parses the czifile version once. For versions earlier than 2019.7.2.3, it aliases imagecodecs.jpegxr_decode to jxr_decode when the latter is missing.

Changes: CZI file compatibility

Layer / File(s) Summary
Decoder alias compatibility
package/PartSegImage/czifile_fixes.py
The code uses the parsed czifile version. For versions earlier than 2019.7.2.3, it adds the jxr_decode alias only when jxr_decode is absent and jpegxr_decode exists.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Merge Risk: Minimal · previous review d210a

This restores import compatibility with older czifile releases when imagecodecs no longer provides jxr_decode. The alias is applied only under narrow conditions, so other setups are unaffected and the merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: restoring the imagecodecs.jxr_decode alias so czifile versions up to 2019.7.2.2 import again. The raw summary confirms the alias is added when czifile is older than 20…
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.
Full details: Title check

Explanation

The title names the main change: restoring the imagecodecs.jxr_decode alias so czifile versions up to 2019.7.2.2 import again. The raw summary confirms the alias is added when czifile is older than 2019.7.2.3, jxr_decode is missing, and jpegxr_decode exists. The title's 'fix:' prefix and the version bound match the objectives. The title is specific and concise.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9c274fa and d210a86.

Files selected for processing: 1

  • package/PartSegImage/czifile_fixes.py

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

czifile 2019.7.2.2 (the newest release available on conda-forge for
Python < 3.12) calls the deprecated `imagecodecs.jxr_decode` alias at
import time. That alias was removed in imagecodecs 2026.3.6, so
`import PartSegImage` fails. Restore the alias (it pointed to
`jpegxr_decode`) before importing czifile.
@Czaki
Czaki force-pushed the fix/czifile-imagecodecs-jxr-alias branch from 1ce8a3b to d210a86 Compare December 1, 2026 11:20

@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.

Sourcery assessment

Approved.

@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 reviewed your changes and they look great!

Sourcery assessment

Approved.


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

@Czaki Czaki modified the milestones: 0.17.1, 0.17.2 Dec 1, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 1, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.61%. Comparing base (9c274fa) to head (6a41412).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1515      +/-   ##
===========================================
- Coverage    92.63%   92.61%   -0.02%     
===========================================
  Files          211      211              
  Lines        33247    33248       +1     
===========================================
- Hits         30797    30793       -4     
- Misses        2450     2455       +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 92d64b4 into develop Dec 1, 2026
54 checks passed
@Czaki
Czaki deleted the fix/czifile-imagecodecs-jxr-alias branch December 1, 2026 13:45
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