Skip to content

chore: Drop test against pyside2 in napari repo workflow#1352

Open
Czaki wants to merge 2 commits intodevelopfrom
fix_napari_repo
Open

chore: Drop test against pyside2 in napari repo workflow#1352
Czaki wants to merge 2 commits intodevelopfrom
fix_napari_repo

Conversation

@Czaki
Copy link
Collaborator

@Czaki Czaki commented Feb 5, 2026

Add testing napari repo against python 3.13

Summary by Sourcery

Update napari testing configuration to separate repo-based tests from pinned napari versions and expand CI coverage to Python 3.13.

Enhancements:

  • Split tox environments so napari widget tests run only against pinned napari versions while full test suite runs against the napari repo for selected Qt backends.
  • Stop running napari repo tests with the PySide2 backend in favor of PyQt5, PyQt6, and PySide6.

CI:

  • Extend the napari repo GitHub Actions workflow matrix to include Python 3.13.

Summary by CodeRabbit

  • Chores
    • Expanded Python version testing to include Python 3.13
    • Reorganized test environment configuration for improved compatibility testing
  • Bug Fixes
    • Viewer window now appears after initial setup completes to prevent premature rendering or display issues

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 5, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates tox environments and CI workflow to stop running full napari-repo tests with PySide2 and to add Python 3.13 coverage for napari-repo, while keeping widget-only tests for released napari versions across all backends.

Flow diagram for updated tox environments and backend coverage

flowchart TD
    start["Start tox invocation"] --> select_env["Select tox environment"]

    subgraph released_napari["Widget tests for released napari"]
        select_env --> env_widgets
        env_widgets --> choose_py_version["Python version py39, py310, py311, py312, py313"]
        choose_py_version --> choose_backend["Qt backend PyQt5, PySide2, PyQt6, PySide6"]
        choose_backend --> choose_napari_version["napari version 0.4.19 or 0.5.4"]
        choose_napari_version --> install_released["Install napari from PyPI"]
        install_released --> run_widgets_pytest["Run pytest on test_napari_widgets with JSON report"]
    end

    subgraph napari_repo["Full tests for napari repo"]
        select_env --> env_repo
        env_repo --> choose_py_version_repo["Python version py310, py311, py312, py313"]
        choose_py_version_repo --> choose_backend_repo["Qt backend PyQt5, PyQt6, PySide6"]
        choose_backend_repo --> install_repo["Install napari from GitHub napari/napari"]
        install_repo --> run_full_pytest["Run pytest on package/tests with JSON report"]
    end

    run_widgets_pytest --> end_widgets["End widget test env"]
    run_full_pytest --> end_repo["End repo test env"]
Loading

File-Level Changes

Change Details Files
Refactor tox napari testenvs to separate napari-repo runs and drop PySide2 for napari-repo while keeping widget tests for released napari versions.
  • Remove napari_repo factor from the combined napari testenv matrix and restrict it to napari 0.4.19 and 0.5.4 only.
  • Simplify commands for the released napari testenvs to always run the widget-focused test module with verbose output.
  • Introduce a new dedicated napari_repo testenv limited to Python 3.10–3.13 and the Qt backends PyQt5, PyQt6, and PySide6, depending on napari from the GitHub repo and running the full test suite.
tox.ini
Extend GitHub Actions napari-repo workflow to test against Python 3.13.
  • Update the Python version matrix in the napari-repo workflow to include Python 3.13 alongside existing versions.
.github/workflows/test_napari_repo.yml

Possibly linked issues

  • #test-bot: PR updates napari repo tox and workflow matrix, likely addressing the failing napari repo workflow reported in issue.

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
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Updates CI and test configuration: adds Python 3.13 to the napari test matrix, splits napari repo tests into a dedicated tox environment, and defers showing the napari Viewer until after initialization in one GUI module.

Changes

Cohort / File(s) Summary
CI/CD Python Matrix
.github/workflows/test_napari_repo.yml
Adds Python 3.13 to the test_napari job matrix (now: 3.10, 3.11, 3.12, 3.13).
Tox environment reorg
tox.ini
Removes napari_repo from the original testenv matrix, adds a new dedicated py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo testenv that installs git+https://github.com/napari/napari.git and runs package tests; original envs keep napari 0.4.19.post1 and 0.5.4 variants.
Viewer show timing
package/PartSeg/common_gui/main_window.py
Instantiates Viewer with show=False and calls viewer.show() after initialization to delay window display until setup completes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

skip check PR title

Poem

🐰🌿 I hopped through YAML, tox, and code,
Let Python 3.13 join the testing road.
I paused the viewer, then gave it a peek—
Tests split neatly, CI feels sleek.
Hooray! A carrot for every passing build. 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title focuses on dropping PySide2 testing, but the changeset primarily reorganizes napari testing environments and adds Python 3.13 support—the PySide2 removal is a secondary consequence of the broader restructuring. Revise the title to reflect the main objective: something like 'chore: Reorganize napari testing and add Python 3.13 support' or 'chore: Split napari repo and pinned version tests, add Python 3.13'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_napari_repo

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 and usage tips.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

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, and left some high level feedback:

  • In the new [testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo] you dropped the -v flag from the pytest invocation compared to the other napari testenvs; if that wasn’t intentional, consider adding -v for consistent output across environments.
  • The pytest command and JSON report options are now duplicated between the napari widget env and the new napari_repo env; consider extracting the common command into a factor or a shared commands snippet to keep the tox config DRY and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the new `[testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo]` you dropped the `-v` flag from the pytest invocation compared to the other napari testenvs; if that wasn’t intentional, consider adding `-v` for consistent output across environments.
- The pytest command and JSON report options are now duplicated between the napari widget env and the new `napari_repo` env; consider extracting the common command into a factor or a shared `commands` snippet to keep the tox config DRY and easier to maintain.

## Individual Comments

### Comment 1
<location> `tox.ini:84` </location>
<code_context>
+    python -m pytest -v package/tests/test_PartSeg/test_napari_widgets.py --json-report --json-report-file={toxinidir}/report-{envname}-{sys_platform}.json {posargs}
+
+
+[testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo]
+deps =
+    {[testenv]deps}
</code_context>

<issue_to_address>
**question (testing):** The napari_repo env drops PySide2 and py39; confirm this reduction in matrix is intentional.

Previously, `napari_repo` ran on `py{39,310,311,312,313}-{PyQt5,PySide2,PyQt6,PySide6}`; now it’s only `py{310,311,312,313}-{PyQt5,PyQt6,PySide6}`. Unless this is due to an intentional upstream drop of py39/PySide2 support, consider keeping those combos so we don’t silently lose coverage for configurations users may still depend on.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

python -m pytest -v package/tests/test_PartSeg/test_napari_widgets.py --json-report --json-report-file={toxinidir}/report-{envname}-{sys_platform}.json {posargs}


[testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo]
Copy link
Contributor

Choose a reason for hiding this comment

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

question (testing): The napari_repo env drops PySide2 and py39; confirm this reduction in matrix is intentional.

Previously, napari_repo ran on py{39,310,311,312,313}-{PyQt5,PySide2,PyQt6,PySide6}; now it’s only py{310,311,312,313}-{PyQt5,PyQt6,PySide6}. Unless this is due to an intentional upstream drop of py39/PySide2 support, consider keeping those combos so we don’t silently lose coverage for configurations users may still depend on.

@Czaki Czaki changed the title Drop test against pyside2 in napari repo workflow chore:Drop test against pyside2 in napari repo workflow Feb 5, 2026
@Czaki Czaki changed the title chore:Drop test against pyside2 in napari repo workflow chore: Drop test against pyside2 in napari repo workflow Feb 5, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@tox.ini`:
- Around line 84-89: The napari git dependency in the testenv named
testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo is unpinned;
replace the deps entry git+https://github.com/napari/napari.git with a pinned
reference to a tag or commit (e.g.
git+https://github.com/napari/napari.git@vX.Y.Z or
git+https://github.com/napari/napari.git@<commit-hash>#egg=napari) to ensure CI
reproducibility, updating the deps line in that testenv block (keep the env name
and other deps identical).

Comment on lines +84 to +89
[testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo]
deps =
{[testenv]deps}
git+https://github.com/napari/napari.git
commands =
python -m pytest package/tests --json-report --json-report-file={toxinidir}/report-{envname}-{sys_platform}.json {posargs}
Copy link
Contributor

@coderabbitai coderabbitai bot Feb 6, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

PyQt5 Python 3.13 wheels support

💡 Result:

PyQt5 does support Python 3.13 via wheels, but not as “cp313” wheels.

  • The latest PyQt5 release on PyPI (5.15.11, uploaded Jul 19, 2024) publishes cp38-abi3 wheels for Windows (x86/x64), macOS (x86_64/arm64), and Linux x86_64 (manylinux glibc ≥ 2.17). Because they’re abi3 wheels, they are usable on CPython 3.8+ (including 3.13). [1]
  • If your install pulls in Qt libraries via PyQt5-Qt5 / pyqt5-qt5, note that its wheels exist for Linux x86_64 and macOS, and (at least for recent versions like 5.15.18, Nov 9 2025) do not include Windows wheels. [2] (On Windows, PyQt5’s own wheel is the one you’ll typically rely on.)
  • On non-x86_64 Linux (e.g., Raspberry Pi), you may need platform-specific wheels from third parties (example: pyqt5-sip has cp313 wheels on piwheels), or build from source / use conda. [3]

What to do: on Python 3.13, try pip install PyQt5—if you’re on a supported platform above, pip should select the abi3 wheel automatically. [1]

Sources: PyQt5 on PyPI [1], pyqt5-qt5 on PyPI [2], piwheels pyqt5-sip builds [3].


🌐 Web query:

PyQt5 version 5.15 Python 3.13 compatibility

💡 Result:

PyQt5 5.15.x is compatible with Python 3.13, as long as you install a recent PyQt5 5.15 release and its current dependencies:

  • PyQt5 (latest 5.15.11) on PyPI declares “Requires: Python >=3.8” and ships cp38-abi3 wheels, which are intended to work on CPython 3.8+ (including 3.13). (pypi.org)
  • PyQt5-sip provides CPython 3.13 (cp313) wheels in recent releases (e.g., 12.18.0, uploaded Jan 13, 2026), which is important because PyQt5 depends on it. (pypi.org)

Practical guidance:

  • Use pip install PyQt5 (don’t pin an old PyQt5-sip), so pip can pick up a cp313 PyQt5-sip wheel automatically. (pypi.org)

Citations:


Pin the napari git dependency to a tag/commit for CI reproducibility.

Using an unpinned git+ dependency makes builds non-deterministic and can break on upstream changes. Pin to a specific tag or commit hash.

PyQt5 supports Python 3.13 via cp38-abi3 wheels (PyQt5 5.15.11+) and its pyqt5-sip dependency provides cp313 wheels, so py313-PyQt5 does not need exclusion on supported platforms (Windows x86/x64, macOS, Linux x86_64).

🔧 Suggested pinning for reproducibility
 deps =
     {[testenv]deps}
-    git+https://github.com/napari/napari.git
+    git+https://github.com/napari/napari.git@<tag-or-commit>
🤖 Prompt for AI Agents
In `@tox.ini` around lines 84 - 89, The napari git dependency in the testenv named
testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo is unpinned;
replace the deps entry git+https://github.com/napari/napari.git with a pinned
reference to a tag or commit (e.g.
git+https://github.com/napari/napari.git@vX.Y.Z or
git+https://github.com/napari/napari.git@<commit-hash>#egg=napari) to ensure CI
reproducibility, updating the deps line in that testenv block (keep the env name
and other deps identical).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This workflow is intentionally to check if there is some napari incompatibility before the release of the next version

Copy link
Contributor

Choose a reason for hiding this comment

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

@Czaki, thank you for the clarification! You're absolutely right—testing against the latest napari development version is a great practice for catching compatibility issues early. The unpinned dependency is appropriate for this pre-release testing workflow.

I appreciate the context and apologize for the noise on this one.


✏️ Learnings added
Learnt from: Czaki
Repo: 4DNucleome/PartSeg PR: 1352
File: tox.ini:84-89
Timestamp: 2026-02-06T10:35:06.033Z
Learning: In the PartSeg repository, the testenv:py{310,311,312,313}-{PyQt5,PyQt6,PySide6}-napari_repo in tox.ini intentionally uses an unpinned git dependency (git+https://github.com/napari/napari.git) to test against the latest napari development version and catch incompatibilities before napari releases.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: Czaki
Repo: 4DNucleome/PartSeg PR: 1206
File: .github/workflows/test_napari_widgets.yml:30-30
Timestamp: 2024-10-17T12:19:43.905Z
Learning: In the CI configuration, `napari54` corresponds to napari version `0.5.4`.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

@Czaki Czaki added the skip check PR title skip spellcheking PR title label Feb 6, 2026
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.15%. Comparing base (09f502f) to head (3eb6d6f).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1352      +/-   ##
===========================================
- Coverage    93.17%   93.15%   -0.02%     
===========================================
  Files          210      210              
  Lines        33253    33254       +1     
===========================================
- Hits         30983    30979       -4     
- Misses        2270     2275       +5     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip check PR title skip spellcheking PR title

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant