Enhance GitHub Actions CI and deploy workflow#122
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Modernizes the repository’s GitHub Actions CI/CD by expanding the test matrix to newer Python versions and multiple OSes, and by refreshing the packaging/deploy steps for PyPI releases.
Changes:
- Expanded CI matrix to
ubuntu-latest,windows-latest,macos-latestand Python3.10–3.12, with pip caching enabled. - Refactored CI install/test steps to install only
tox/tox-gh-actionsand run tox (with Linux using Xvfb). - Updated release deploy job to build via
python -m buildand publish viatwine.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
8f63720 to
6cc0c75
Compare
C-Achard
added a commit
that referenced
this pull request
May 19, 2026
* Consolidate project config into pyproject and modernize CI 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. * Disable flaky test; use ndarray.reshape; fix viewer 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. * Enhance GitHub Actions CI and deploy workflow (#122) * 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 * Add setuptools_scm versioning and CI improvements 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. * Skip weight download test on CI 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. * Add tests for plugin_base SingleImage/Folder 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. * Set Windows env vars in tox.ini 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. * Use qtbot and QWidget in navigation test 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. * Add setenv header to tox.ini 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. * Fix optional PyQt deps Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Update tox.ini * Revert "Update tox.ini" This reverts commit 89921c7. * Use napari viewer fixture in test_relabel 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. --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Update CI following changes in #120 to run with latest python versions, and other tiny workflow improvements.
CI/CD Workflow Modernization and Expansion:
ubuntu-latest,windows-latest, andmacos-latestplatforms, and Python versions 3.10, 3.11, and 3.12, increasing test coverage and compatibility.actions/checkout,actions/setup-python,codecov/codecov-action) to the latest major versions for improved reliability and security.Testing Improvements:
toxand removing direct installs of other libraries, delegating totoxfor environment management.Deployment Workflow Enhancements:
python -m buildfor package creation before uploading withtwine.