Upgrade python support to 3.10-3.12, fix deprecation errors#120
Merged
Conversation
Remove legacy packaging and test config files (setup.cfg, requirements.txt, .isort.cfg, napari_cellseg3d/_tests/pytest.ini, and its conftest). Migrate and update metadata in pyproject.toml: bump supported Python classifiers to 3.10–3.12, add napari manifest entry-point, include napari.yaml in package data, simplify dynamic fields, adjust optional dependencies (add PyQt6, pyside6, move pydensecrf2 to crf extra) and streamline dev dependencies (remove black/isort as direct dev deps). Update tooling rules (ruff token change) and remove redundant tool configs. Update tox.ini to target py310/311/312 across linux/windows/macos, expose platform mappings for GH Actions, and switch to using extras for test/crf/pyqt6 while keeping usedevelop and running pytest as the test command.
Skip a test that causes GitHub Actions to freeze by importing pytest and marking it skipped (needs to be fixed or removed). In worker_inference, replace np.reshape(...) with the ndarray.reshape(...) call and remove an obsolete commented reshape for clarity. In dev_scripts/correct_labels, initialize a napari.Viewer and add the image via viewer.add_image instead of calling napari.view_image(), ensuring the image layer is properly created.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes package/test configuration for the supported Python 3.10-3.12 range and consolidates dependency and packaging metadata into pyproject.toml.
Changes:
- Updates tox and project metadata for newer Python versions.
- Moves/removes legacy packaging, dependency, lint, and Qt test configuration files.
- Adjusts a napari viewer initialization path, NumPy reshape usage, and CI skip behavior for a weight-download test.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
tox.ini |
Updates tox environment mappings and test extras. |
setup.cfg |
Removes legacy setuptools metadata/configuration. |
requirements.txt |
Removes the standalone requirements list. |
pyproject.toml |
Consolidates packaging metadata, entry points, extras, and lint config. |
napari_cellseg3d/dev_scripts/correct_labels.py |
Changes viewer creation when relabeling. |
napari_cellseg3d/code_models/worker_inference.py |
Minor formatting and reshape update. |
napari_cellseg3d/_tests/test_weight_download.py |
Adds conditional CI skip for the download test. |
napari_cellseg3d/_tests/pytest.ini |
Removes old Qt pytest configuration. |
napari_cellseg3d/_tests/conftest.py |
Removes Qt offscreen test fixture. |
.isort.cfg |
Removes legacy isort config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Enhance GitHub Actions CI and deploy workflow Modernize and expand the test-and-deploy workflow: bump action versions (checkout/setup-python), enable pip caching, and broaden the matrix to ubuntu, windows, and macos with Python 3.10–3.12. Add fail-fast:false and platform-specific steps (Linux Qt libs, Windows OpenGL with pwsh). Install tox centrally and run tests per-OS with appropriate Qt/PyQt and PyVista env vars; upload coverage with codecov v6. Adjust deploy job to trigger on semver-style tags (refs/tags/v*), update setup actions, split build and publish steps (build then twine upload), and simplify dependency installs. * Fix missing OSs in tox.ini
Enable setuptools_scm-based versioning and tighten CI/build checks. Updates include: - Use setuptools_scm: add setuptools-scm to build-system requires and configure version_file in pyproject.toml so package version is generated into napari_cellseg3d/_version.py. - Make package import version dynamically: __init__.py now prefers the generated _version and falls back to importlib.metadata.version. - Bump minimum Python to >=3.10 in pyproject. - CI/workflow changes: fetch full Git history (fetch-depth: 0), restrict Codecov upload to ubuntu-latest + Python 3.12, pin the build job to Python 3.12, and add a twine check step before publishing. - Minor dev script cleanup: remove unused assignment when adding image to napari viewer. These changes improve reproducible versioning, ensure the build uses an appropriate Python/tooling set, and add a safety check before publishing.
Use the generic CI environment variable when skipping the weight download test (os.getenv("CI") instead of "GITHUB_ACTIONS") and update the skip reason to mention CI. Also add a small formatting tweak (blank line after import) and adjust file ending.
Expand unit test coverage for napari_cellseg3d.code_plugins.plugin_base. Rename a test for updating default paths and add many new tests covering: results path creation/validation, _build not implemented, navigation buttons, dock widget removal (including LookupError handling), dataset path extraction, folder plugin default path updates, dataset loading (images, labels, unsupervised), dataset load warnings, file/folder dialog integrations (filetype and path updates), and visibility helpers. Also add necessary imports and use plugin_base for monkeypatching ui/utils/logger behaviors.
Add Windows-specific environment variables to tox.ini passenv: set USERNAME to 'runneradmin' and TORCHINDUCTOR_CACHE_DIR to {envtmpdir}/torchinductor. Ensures Windows test runs use a consistent username and place TorchInductor cache in the temporary directory.
Update test_make_navigation_buttons to use real QWidget instances and the qtbot fixture instead of SimpleNamespace. The test now accepts qtbot, creates two QWidgets, registers them with qtbot.addWidget, and adds them as tabs before checking navigation buttons—ensuring proper Qt widget management and avoiding teardown/warning issues.
Insert the missing `setenv` key in tox.ini so the Windows-specific environment variables (USERNAME, TORCHINDUCTOR_CACHE_DIR) are declared under the correct section. This fixes configuration formatting and ensures those variables are applied in tox runs on Windows.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This reverts commit 89921c7.
Update test_relabel to use the make_napari_viewer_proxy fixture: create a viewer instance and pass it to cl.relabel via viewer=viewer. This ensures the relabel test runs with a proxied Napari viewer (e.g. for headless/test environments) and verifies behavior when a viewer is provided.
MMathisLab
approved these changes
May 19, 2026
Collaborator
Author
|
Confirmed: inference works on all models + GPU support is fine |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Scope
Merge Update and run all pre commit hooks #121 into this branchMerge into main separately for reviewAutomated summary
This pull request updates the project's Python and dependency management, improves compatibility with newer Python versions, and simplifies the testing and configuration setup. The main themes are modernization of Python version support, dependency and configuration cleanup, and improvements to test reliability and packaging.
Python Version and Dependency Modernization:
pyproject.tomlandtox.ini, updating the test matrix and classifiers accordingly. [1] [2]setup.cfgfile in favor of a modernpyproject.toml-based configuration, consolidating all package metadata and dependencies. [1] [2] [3]tqdmfrom the main requirements and development dependencies, and added optional extras forcrfandpyqt6. [1] [2] [3] [4]Testing and CI Improvements:
tox.inito use only supported Python versions and platforms, addedpyqt6andcrfextras for testing, and removed direct dependency installations in favor of extras. [1] [2]test_weight_download.pyto prevent CI freezes on GitHub Actions. [1] [2]Configuration and Linting Cleanup:
.isort.cfgand integrated relevant settings intopyproject.toml, also cleaning up oldblackandisortsettings. [1] [2]rufflinter configuration, including rule selection and exclusion of unnecessary settings. [1] [2]Packaging Improvements:
napari.yamlto package data and defined the napari manifest entry point inpyproject.tomlfor correct plugin packaging. [1] [2]package-datasection.Minor Code and Usability Tweaks:
relabelfunction incorrect_labels.pyfor correct napari viewer initialization.worker_inference.py. [1] [2] [3]These changes collectively make the plugin ready for the current 3.10-3.12 window.