Skip to content

Commit

Permalink
build: Enforce napari 0.5.0 for Qt6 bindings (#1161)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Improved version checks for dependencies to ensure compatibility with
`napari` and `pydantic`.
- Enhanced error handling for incompatible versions of critical
dependencies.

- **Bug Fixes**
- Adjusted dependency specifications for `napari`, requiring a minimum
version of `0.5.0` for better stability, for qt6 bindings

- **Chores**
- Refined import statements for better clarity and organization within
the code.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
Czaki authored Jul 19, 2024
1 parent 46be04f commit 150c68e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions package/PartSeg/launcher_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from contextlib import suppress
from functools import partial

from PartSeg._launcher.check_survey import CheckSurveyThread

multiprocessing.freeze_support()


Expand Down Expand Up @@ -81,7 +79,17 @@ def create_parser():
return parser


def main(): # pragma: no cover
def main(): # pragma: no cover # noqa: PLR0915
from importlib.metadata import version

from packaging.version import parse as parse_version

napari_version = parse_version(version("napari"))
pydantic_version = parse_version(version("pydantic"))
if napari_version < parse_version("0.4.19") and pydantic_version >= parse_version("2"):
print("napari version is too low, please update to version 0.4.19 or higher or downgrade pydantic to version 1")
sys.exit(1)

if len(sys.argv) > 1 and sys.argv[1] == "_test":
_test_imports()
return
Expand All @@ -100,6 +108,7 @@ def main(): # pragma: no cover
from qtpy.QtWidgets import QApplication

from PartSeg import state_store
from PartSeg._launcher.check_survey import CheckSurveyThread
from PartSeg._launcher.check_version import CheckVersionThread
from PartSeg.common_backend import napari_get_settings
from PartSegData import icons_dir
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pyqt5 = [
]
pyqt6 = [
"PyQt6",
"napari[pyqt6]",
"napari[pyqt6]>=0.5.0",
]
pyside = [
"PartSeg[pyside2]",
Expand All @@ -139,7 +139,7 @@ pyside2 = [
]
pyside6 = [
"PySide6",
"napari[pyside6_experimental]",
"napari[pyside6_experimental]>=0.5.0",
]
test = [
"coverage",
Expand Down

0 comments on commit 150c68e

Please sign in to comment.